JavaScript Array every()

The JavaScript array every() method is used to determine whether all the elements of an array are satisfying the provided function conditions.


array.every (callback (currentValue, index, arr), thisArg)

Parameters: callback: It represents the method to test the condition. It is required. currentValue: It represents the array’s current element. It is required. index: Current element index. It is optional. arr: It represents the array on which every() method is to be invoked. It is optional. thisArg: It is used as this keyword while executing callback. It is optional.

Returns: Return true if all the elements of an array satisfy the specified conditions else return true.


<!DOCTYPE html>
function check(value)
return value == "RUBY";
Please follow and like us:
Content Protection by