Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

js any array

 
// 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 });
}
 
PREVIOUS NEXT
Tagged: #js #array
ADD COMMENT
Topic
Name
9+1 =