Check if an array contains a string, ignoring upper- or lowercase in JavaScript - Printable Version +- QP School (https://qomplainerzschool.lima-city.de) +-- Forum: Tutorials (https://qomplainerzschool.lima-city.de/forumdisplay.php?fid=3) +--- Forum: JavaScript Tutorials (https://qomplainerzschool.lima-city.de/forumdisplay.php?fid=6) +--- Thread: Check if an array contains a string, ignoring upper- or lowercase in JavaScript (/showthread.php?tid=4073) |
Check if an array contains a string, ignoring upper- or lowercase in JavaScript - Qomplainerz - 04-04-2023 // 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); |