On this podcast we talk about the Array prototype function Array.every().  Here are some code examples for the Array.Every() function:

 

const x = [1, 2, 3, 4, 5]
x.every((element) => { 
  return element > 0;
})
// true

x.every((element) => { 
  return element !== 4;
})
// false

x.every((element, ind) => { 
  // element would be 1 while ind is 0, 2 > 1, and so on  
  return element > ind;
})
// true

 

Useful Links:

Array.Includes()

Array.Every()

JsPerf

 

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *

Fullstack Javascript Podcast © 2017