Function Updated 17 Oct 2026
Array.every(callback)
Tests whether every item passes the test function. Stops at the first item for which the function returns a falsy value.
Parameters
callbackfunctionrequiredFunction called with (item, index, array). Return a truthy value to continue.
Returns
true if the function returned a truthy value for every item, otherwise false. An empty array gives true.
Example
Normal JavaScript, running in the browser or on the Docly™ server.
const items = ["abc", "def", "ghi"];
var result = items.every(x => {
write(x);
return !x.startsWith("d"); /* Iteration will stop after item 2 */
});
write("\n");
write("Result: " + result);The JavaScript above produces this output:
abcdef
Result: false