【javascript】[].slice.call(arguments)的作用

 

var thisExtends = function () {
            var args = [].slice.call(arguments).filter(function (item) {
                return item.mi !== undefined;
            });
            return args;
        }
thisExtends({mi:0},{b:1},{mi:2});// [{mi:0}, {mi:2}]   [].slice.call(arguments)的作用:借助数组的slice方法通过扩展作用域(也可以说是继承方法)将arguments类数组转成数组之用

 

posted @ 2019-06-01 23:10  expworld  阅读(611)  评论(0编辑  收藏  举报