如何在Array.Prototype和Object.Prototype上定义javascript中的
Array.prototype.find = function(testFun) { // code to find element in array};
var arr = [1, 2, 3];var found = arr.find(function(el) { return el > 2; });
for in
for (var prop in arr) { console.log(prop); }// prints out:// 1// 2// 3// find
for in
for in
for in
月关宝盒
相关分类