亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

實(shí)現(xiàn)連綴調(diào)用的map方法(prototype)

 更新時間:2009年08月05日 22:51:01   作者:  
實(shí)現(xiàn)連綴調(diào)用的map方法(prototype),需要學(xué)習(xí)的朋友可以參考下。
復(fù)制代碼 代碼如下:

<script type="text/javascript">
function SpecialArray(arr){
this.arr=arr;
}
SpecialArray.prototype.map=function(func){
for(var i=0,len=this.arr.length;i<len;i++){
this.arr[i]=func(this.arr[i]); //調(diào)用函數(shù),改變arr數(shù)組的每個項(xiàng)的值
}
return this; //返回自身對象
}

var obj=new SpecialArray([ a , b , c ]);
//可以對obj的arr屬性做任何的操作
alert(obj.map(function(el){return el.toUpperCase()}).arr);
alert(obj.map(function(el){return el+"!";}).arr);
</script>

相關(guān)文章

最新評論