javascript array object some code example
Example 1: js find array return true false
['one', 'two'].some(item => item === 'one')
['one', 'two'].some(item => item === 'three')
Example 2: javascript some
const fruits = ['apple', 'banana', 'mango', 'guava'];
function checkAvailability(arr, val) {
return arr.some(function(arrVal) {
return val === arrVal;
});
}
checkAvailability(fruits, 'kela');
checkAvailability(fruits, 'banana');
Example 3: some js
[2, 5, 8, 1, 4].some(isBiggerThan10);
[12, 5, 8, 1, 4].some(isBiggerThan10);