标签:call type rip targe undefined class target log https
特点:拥有length属性,不具有数组的方法。
例子:arguments、document.getElementsByTagName
var a ={"1":"xu", "2": "hao","3":"dong" ,length:4};
Array.prototype.join.call(a, "-"); //"-xu-hao-dong"
①如果属性(索引)为字符串,则属性值不会被数组方法引用。
②如果length为3,则结果为“-xu-hao”
var a ={"x":"xu","h":"hao","d":"dong","1":1,"2":2,length:5};
var arr = Array.prototype.slice.call(a);
console.log(arr); //arr = [1,2]
console.log(arr[1]); //1
console.log(arr[0]); //undefined
console.log(arr.length); //5
标签:call type rip targe undefined class target log https
原文地址:http://www.cnblogs.com/xuhaodong/p/6096031.html