// .every accepts a function as an argument, but returns true // only if the function matches for every item.const numbers =[5,55,66,33,23,12,98,44];constgreaterThanTen=(element)=> element >10;console.log(numbers.every(greaterThanTen));//Expected output is false
<script>// JavaScript code for every() function functionisodd(element, index, array){return(element %2==1);}functiongeeks(){var arr =[6,1,8,32,35];// check for odd number var value = arr.every(isodd);console.log(value);}geeks();</script>
var nums =[1,2,3,4,5,6,7];functioneven(ele){return ele%2==0;}console.log(nums.every(even))/*console.log will show false since not every element is even*/
<script>// JavaScript code for every() methodfunctionisodd(element, index, array){return element %2==1;}functionfunc(){var arr =[56,91,18,88,12];// Check for odd numbervar value = arr.every(isodd);document.write(value);}func();</script>
let array_4 =[50,71,20,29,31,19];functionCheckAdult(value){return value >=18;}let array_5 = array_4.every(CheckAdult);console.log(array_5);// OUTPUT: trueconsole.log(typeof(array_5));// OUTPUT: boolean // When we check the type of of that variable in which we use every(), // so it will return us boolean data type, // because every() returns us true or false after checking if all value of array is satisfied with the condition.