Hosting Solutions
mobile_logo Table of Contents


The every() method of the Array object is used to check if all elements pass an evaluation specified in a callback function. A boolean value is returned. It will stop evaluating elements at the first occurrence of a 'false' return value from the callback function. If all elements pass the evaluation, a 'true' value is returned.

Syntaxarray.every( callback )


callback Reference a callback function that will evaluate each element in the array. element - represents each element of the array individually as they pass through the callback. index - indicates the index number of the element passing through the callback. array - a reference to the array object calling the every() method.


Check whether or not all elements are string object type. function checkData( element, index, array ) { return typeof element == "string"; } var data = ["abc","xyz",true,7]; alert( data.every( checkData ) );