可以自己写一个
Array.prototype.append = function(str) {
var newArr = new Array(str);
return this.concat(newArr);
}Array.prototype.remove = function(str) {
var retArr = new Array();
for(i = 0; i < this.length; i++) {
if(this[i] != str) retArr = retArr.append(this[i]);
}
return retArr;
}Array.prototype.hasItem = function(str) {
for(var i = 0; i < this.length; i++) {
if(this[i] == str) {
return true;
}
}
return false;
}

解决方案 »

  1.   

    没有add,但是有push和unshift方法,没有remove,但有pop和shift方法,如果不行,还有splice方法
      

  2.   


    方法概览
    concat Joins two arrays and returns a new array.  
    join Joins all elements of an array into a string. 
    pop Removes the last element from an array and returns that element. 
    push Adds one or more elements to the end of an array and returns that last element added. 
    reverse Transposes the elements of an array: the first array element becomes the last and the last becomes the first. 
    shift Removes the first element from an array and returns that element 
    slice Extracts a section of an array and returns a new array. 
    splice Adds and/or removes elements from an array. 
    sort Sorts the elements of an array. 
    toString Returns a string representing the specified object. 
    unshift Adds one or more elements to the front of an array and returns the new length of the array. 
      

  3.   

    Array对象方法参考:concat 方法:返回一个新数组,这个新数组是由两个或更多数组组合而成的。array1.concat([item1[, item2[, . . . [, itemN]]]])join 方法 :返回字符串值,其中包含了连接到一起的数组的所有元素,元素由指定的分隔符分隔开来。arrayObj.join(separator)pop 方法 :移除数组中的最后一个元素并返回该元素。arrayObj.pop()push 方法 :将新元素添加到一个数组中,并返回数组的新长度值。arrayObj.push([item1 [item2 [. . . [itemN ]]]])reverse 方法 :返回一个元素顺序被反转的 Array 对象。arrayObj.reverse( )shift 方法 :移除数组中的第一个元素并返回该元素。arrayObj.shift( )slice 方法 :返回一个数组的一段。arrayObj.slice(start, [end]) sort 方法 :返回一个元素已经进行了排序的 Array 对象。arrayobj.sort(sortfunction) splice 方法 :从一个数组中移除一个或多个元素,如果必要,在所移除元素的位置上插入新元素,返回所移除的元素。arrayObj.splice(start, deleteCount, [item1[, item2[, . . . [,itemN]]]])unshift 方法 :将指定的元素插入数组开始位置并返回该数组。arrayObj.unshift([item1[, item2 [, . . . [, itemN]]]])