Skip to main content
fixed case issue
Source Link

To search inside an array you can simply use an Iteration method ( forEach/ map ) and, inside that use JavaScript String search method

Reference https://www.w3schools.com/jsref/jsref_search.asp

Example

const arrayOfLists = ['ape', 'apple', 'auto']; const searchString = "a""A" let matchingStrings = []; arrayOfLists.forEach((list) => { if (list.toLocaleLowerCase().search(searchString.toLocaleLowerCase()) > -1) { matchingStrings.push(list) } }) 

matchingStrings array will have list of all likely occurrences

To search inside an array you can simply use an Iteration method ( forEach/ map ) and, inside that use JavaScript String search method

Reference https://www.w3schools.com/jsref/jsref_search.asp

Example

const arrayOfLists = ['ape', 'apple', 'auto']; const searchString = "a" let matchingStrings = []; arrayOfLists.forEach((list) => { if (list.search(searchString) > -1) { matchingStrings.push(list) } }) 

matchingStrings array will have list of all likely occurrences

To search inside an array you can simply use an Iteration method ( forEach/ map ) and, inside that use JavaScript String search method

Reference https://www.w3schools.com/jsref/jsref_search.asp

Example

const arrayOfLists = ['ape', 'apple', 'auto']; const searchString = "A" let matchingStrings = []; arrayOfLists.forEach((list) => { if (list.toLocaleLowerCase().search(searchString.toLocaleLowerCase()) > -1) { matchingStrings.push(list) } }) 

matchingStrings array will have list of all likely occurrences

Source Link

To search inside an array you can simply use an Iteration method ( forEach/ map ) and, inside that use JavaScript String search method

Reference https://www.w3schools.com/jsref/jsref_search.asp

Example

const arrayOfLists = ['ape', 'apple', 'auto']; const searchString = "a" let matchingStrings = []; arrayOfLists.forEach((list) => { if (list.search(searchString) > -1) { matchingStrings.push(list) } }) 

matchingStrings array will have list of all likely occurrences