I’m wondering if there is any implimentation of a object.contains method in javascript that works similar to how the Python version object.__contains__() works, as in I want to be able to scan the whole object with nested objects to see if there is either a key or a value that does contain what the method is comparing it against. I
Tag: contains
How to check if a string contains text from an array of substrings in JavaScript?
Pretty straight forward. In javascript, I need to check if a string contains any substrings held in an array. Answer There’s nothing built-in that will do that for you, you’ll have to write a function for it, although it can be just a callback to the some array method. Two approaches for you: Array some method Regular expression Array some