Today I Learned

hashrocket A Hashrocket project

Test values of an array

Javascript arrays have a function called some that can be used to determine if at least one element of an array passes a test:

console.log(["1", "2", "3"].some(n => n === 1))
=> false
Looking for help? At Hashrocket, our JavaScript experts launch scalable, performant apps on the Web, Android and iOS. Contact us and find out how we can help you.