JavaScript Array.prototype.every() Guide

JavaScript Logo

Array.prototype.every() – Returns **true** only if *all* elements satisfy the condition.

๐Ÿ‘‰ Syntax

const bool = array.every((element, index, array) => {
  return /* condition */;
}, thisArg);

๐Ÿงช Example

const nums=[2,4,6];
console.log(nums.every(n=>n%2===0)); // true

Comments