Would you like to clone this notebook?

When you clone a notebook you are able to make changes without affecting the original notebook.


Find a value while ignoring the case sensitivity of JavaScript Array Method Includes

node v18.11.0
version: 1.0.0
const names = ['Bob', 'Rachel', 'Jack Christopher', 'RayRay', 'Leon', 'Abigail Marie']; function stringInArray(array, name) { return array.some((item) => item.toLowerCase() === name.toLowerCase()); } console.log('JaCk ChriStopher', stringInArray(names, 'JaCk ChriStopher')); console.log('RAYRAY', stringInArray(names, 'RAYRAY'));

no comments

    sign in to comment