Let's assume that you want to check if a string includes one of a series of values.
let os = 'macOS' let series = ['mac', 'Mac', 'os'] let hasWord = series.some(word => os.includes(word)) // true
In one line of code:
let hasWord = ['mac', 'Mac', 'os'].some(word => 'macOS'.includes(word))
Hi, I'm Erik, an engineer from Barcelona. If you like the post or have any comments, say hi.