可以自己写一个
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;
}
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;
}
解决方案 »
- 使用easyui-validatebox验证表单后如何提交
- jquery uploadify插件动态传参的问题
- 关于全选,反选的问题!!!
- 如何在html中取textarea的内容并传到另一个html页的table中!只有10分了!
- 请帮忙看一小段代码在 Google Chrome 里不工作
- 【求助】如何清理IE内存中的JS变量?各位大侠,Help啊
- 求指点!Missing message for key "login.username"
- 在网页中的javascipt函数如何调用另外一个。js文件的函数,重要的是参数如何调用何返回
- 在JAVASCRIPT里有和LEFT,RIGHT,MID等相对就在的涵数吗(变量中取某一段)
- jquery关于金额计算的问题
- javascript疑问
- 关于$的问题
方法概览
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.