Arry构造器(将所有数组都改为大写)
2018-08-03 10:42 bsdbqling 阅读(263) 评论(0) 编辑 收藏 举报Array.prototype.myUcase=function() { for (i=0;i<this.length;i++) { this[i]=this[i].toUpperCase(); } } function myFunction() { var fruits = ["Banaxczxczxczxczxcna", "Orange", "Apple", "Mango"]; fruits.myUcase(); var x=document.getElementById("demo"); x.innerHTML=fruits; }