js encontrar la matriz return verdadero falso
['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
[2, 5, 8, 1, 4].some(isBiggerThan10); // false
[12, 5, 8, 1, 4].some(isBiggerThan10); // true
const numbers = [45, 4, 9, 16, 25];
let someOver18 = numbers.some(myFunction);
function myFunction(value, index, array) {
return value > 18;
}
function isBiggerThan10(element, index, array) {
return element > 10;
}
[2, 5, 8, 1, 4].some(isBiggerThan10); // false
[12, 5, 8, 1, 4].some(isBiggerThan10); // 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>