📜  javascript array any - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:01:22.750000             🧑  作者: Mango

代码示例6
// 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 });
}