JS encontre a matriz Return True False
['one', 'two'].some(item => item === 'one') // true
['one', 'two'].some(item => item === 'three') // false
foloinfo
['one', 'two'].some(item => item === 'one') // true
['one', 'two'].some(item => item === 'three') // false
const fruits = ['apple', 'banana', 'mango', 'guava'];
function checkAvailability(arr, val) {
return arr.some(function(arrVal) {
return val === arrVal;
});
}
checkAvailability(fruits, 'kela'); // false
checkAvailability(fruits, 'banana'); // true
<script>
// JavaScript code for some() 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.some(isodd);
console.log(value);
}
geeks();
</script>
function isBiggerThan10(element, index, array) {
return element > 10;
}
[2, 5, 8, 1, 4].some(isBiggerThan10); // false
[12, 5, 8, 1, 4].some(isBiggerThan10); // true