JavaScript array.every() Function

JavaScript Logo

array.every() – Checks whether **all** elements pass the test implemented by the callback.

๐Ÿ‘‰ Syntax

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

๐Ÿงช Example

const nums=[3,5,8];
console.log(nums.every(n => n > 2)); // true

Comments