码迷,mamicode.com
首页 > 编程语言 > 详细

JS根据数组下表删除元素

时间:2017-07-31 20:45:23      阅读:111      评论:0      收藏:0      [点我收藏+]

标签:span   根据   nbsp   move   this   ++   logs   class   type   

//新增根据数组下表remove元素方法
    Array.prototype.remove = function(obj){
        
        for(var i=0;i<this.length;i++){
            var temp = this[i];
            if(!isNaN(obj)){
                temp=i;
            }
            if(temp == obj){
                for(var j=i ;j<length;j++){
                    this[j] = this[J+1];
                }
                this.length = this.length-1 ;
            }
        }
    }

 

JS根据数组下表删除元素

标签:span   根据   nbsp   move   this   ++   logs   class   type   

原文地址:http://www.cnblogs.com/lq-3323/p/7265366.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!