Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

js some

// Use method "some" to loop through array elements and see if there are any matching ones
const array = [{ name: 'Dharmesh', gender: 'male' }, { name: 'Priti', gender: 'female' }];
const hasFemaleContender = array.some(({ gender }) => gender === 'female');
console.log(hasFemaleContender);
 
PREVIOUS NEXT
Tagged: #js
ADD COMMENT
Topic
Name
9+3 =