Find a value while ignoring the case sensitivity of JavaScript Array Method Includes
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