Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript array some

var nums = [1, 2, 3, 4, 5, 6, 7];

function even(ele)
{
    return ele%2 == 0;
    
}
console.log(nums.some(even))
/*consol.log will show true because at least one of the elements is even*/
Source by www.geeksforgeeks.org #
 
PREVIOUS NEXT
Tagged: #javascript #array
ADD COMMENT
Topic
Name
7+6 =