How to find multiple elements in Array – Javascript ,ES6

You have to use filter at this context,

let names= ["Style","List","Raw"];
let results= names.filter(x => x.includes("s"));
console.log(results); //["List"]

If you want it to be case insensitive then use the below code,

let names= ["Style","List","Raw"];
let results= names.filter(x => x.toLowerCase().includes("s"));
console.log(results); //["Style", "List"]

To make it case in sensitive, we have to make the string’s character all to lower case.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)