javascript includes method getting 27hi 27 and 27high 27 problem

Solutions on MaxInterview for javascript includes method getting 27hi 27 and 27high 27 problem by the best coders in the world

showing results for - "javascript includes method getting 27hi 27 and 27high 27 problem"
Irene
29 Jan 2016
1const multiSearchOr = (text, searchWords) => (
2  searchWords.some((el) => {
3    return text.match(new RegExp(el,"i"))
4  })
5)
6
7multiSearchOr("Chelsey Dietrich Engineer 2018-12-11 Hire", ["che", "hire"]) //returns true
8multiSearchOr("Chelsey Dietrich Engineer 2018-12-11 Hire", ["aaa", "hire"]) //returns true
9multiSearchOr("Chelsey Dietrich Engineer 2018-12-11 Hire", ["che", "zzzz"]) //returns true
10multiSearchOr("Chelsey Dietrich Engineer 2018-12-11 Hire", ["aaa", "1111"]) //returns false
11
Kia
30 May 2019
1var str = 'hilly';
2var value = str.includes('hi'); //true, even though the word 'hi' isn't found
3var value = /\bhi\b/.test(str); //false - 'hi' appears but not as its own word
4