摘要: 【function定义】A.function alertArgsCount(){ alert("函数调用时的参数个数:"+arguments.length);}B.var funBody="if(a>b) return a-b; else return b-a;"var getDiffValue=new Function("a","b",funBody);alert(getDiffValue(12,125));alert("函数定义时的参数个数为:"+getDiffValue.length 阅读全文
posted @ 2010-11-14 17:44 极简 阅读(387) 评论(0) 推荐(0)
摘要: //Apple构造函数function Apple(color,weight,home) { //设置属性的值 this.color=color; this.weight=weight; this.home=home; this.price = new Array(12,15); //[12,15]; if(typeof Apple.created == "undefined") { //添加一个方法 这种方法 确保 定义的方法 只构造一次 而不会每次实例化都定义一次 Apple.prototype.showHome=funct... 阅读全文
posted @ 2010-11-14 17:34 极简 阅读(290) 评论(0) 推荐(0)