“Array.Every ()” Code-Antworten

JavaScript alles

const age= [2,7,12,17,21];
age.every(function(person){
return person>18;
});  //false

//es6
const age= [2,7,12,17,21];
age.every((person)=> person>18);  //false
Batman

Array.Every ()

<script>
  
// JavaScript code for every() function 
function isodd(element, index, array) {  
    return (element % 2 == 1);  
} 
    
function geeks() { 
    var arr = [ 6, 1, 8, 32, 35 ]; 
      
    // check for odd number 
    var value = arr.every(isodd); 
    console.log(value); 
} 
geeks(); 
</script>
Helpless Hummingbird

Js alle

function isBigEnough(element, index, array) {
  return element >= 10;
}
[12, 5, 8, 130, 44].every(isBigEnough);   // false
[12, 54, 18, 130, 44].every(isBigEnough); // true
DevLorenz02

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen