3分钟
创建新方法
原型是JavaScript全局构造函数。它可以构建新Javascript对象的属性和方法。
Array.prototype.myUcase=function(){
for (i=0;i<this.length;i++){
this[i]=this[i].toUpperCase();
}
} 上面的例子创建了新的数组方法用于将数组小写字符转为大写字符。
原型是JavaScript全局构造函数。它可以构建新Javascript对象的属性和方法。
Array.prototype.myUcase=function(){
for (i=0;i<this.length;i++){
this[i]=this[i].toUpperCase();
}
} 上面的例子创建了新的数组方法用于将数组小写字符转为大写字符。
Copyright © 2013-2025 Tencent Cloud.All Rights Reserved. 腾讯云 版权所有
学员评价