QP School

Full Version: Check if an array contains a string, ignoring upper- or lowercase in JavaScript
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
// Check if an array contains a string ignoring upper- or lowercase in JavaScript

const colors = ['Red', 'GREEN', 'Blue'];
const result = colors.map(e => e.toLocaleLowerCase())
.includes('green');

document.write(result);