Array.prototype.deleteEle = function() { var newArr = this; for (var i = newArr.length - 1; i >= 0; i--) { var targetNode = newArr[i]; for (var j = 0; j < i; j++) { if (targetNode == newArr[j]) { newArr.splice(i, 1); break; } } } return newArr; }
调用:array.deleteEle ();
时间: 2024-10-29 01:17:53