Check if a substring exists in an array Javascript - Stack Overflow


Thu May 28 2020 08:13:30 GMT+0000 (Coordinated Universal Time)

Saved by @nikhil3790 #javascript

The includes array method checks whether the string "Gold" is contained as an item in the array, not whether one of the array items contains the substring. You'd want to use some with the includes string method for that:

Ressources.some(res => res.includes("Gold"))