check every value in array javascript

Solutions on MaxInterview for check every value in array javascript by the best coders in the world

we are a community of more than 2 million smartest coders
registration for
employee referral programs
are now open
get referred to google, amazon, flipkart and more
register now
  
pinned-register now
showing results for - "check every value in array javascript"
Angela
20 Feb 2020
1["foo", "foo", "foo"].every((item, index) => item === "foo") // returns true since every item matches our condition
2["foo", "bar", "foo"].every((item, index) => item === "foo") // return false because not all items match our condtion