js any array
let array = [1, 2, 3, 4, 5];
//Is any element even?
array.some(function(x) {
return x % 2 == 0;
}); // true
// There's no isEmpty or any method.
// You can define your own .isEmpty() or .any()
Array.prototype.isEmpty = function() {
return this.length === 0;
}
Array.prototype.any = function(func) {
return this.some(func || function(x) { return x });
}
Also in JavaScript:
- onPress image react native
- rotation in p5 play
- add to json object javascript
- localecompare javascript
- HOW TO SPLIT AN ARRAY JAVASCRIPT
- count number of times an element is occuring in an array in javascript
- json stringify close circle
- build react app
- fs.writefile
- how to display an image on text click using jQuery
- jquery number format thousand k
- log javascript
- pass array to function javascript
- package json add git repo
- variable key name js
- js check if date is future
- for of mdn
- loopback ilike
- jquery format date
- js camelcase
- js crpyto generate safe token
- javascript last element of array
- sum range javascript
- GET http://localhost:8000/js/app.js net::ERR_ABORTED 404 (Not Found) in laravel 6