-
try-catch 提供了捕获异常的方法 1、执行try中代码 2、如果跑出了异常会由catch去捕获执行(如果没有发生异常catch中的代码会被忽略掉) 3、无论是否有异常都会执行finally语句 注意: try后面必须跟着catch或finally查看全部
-
var a =b =1; 其中b是隐式地创建了全局变量。查看全部
-
函数内定义的局部变量,函数外是拿不到的查看全部
-
没有块级作用域查看全部
-
没有块级作用域查看全部
-
块语句查看全部
-
note查看全部
-
function person(){ var args=arguments; if(typeof args[0]==='object'&& args[0]){ if(args[0].name){ this.name=args[0].name; } if(args[0].age){ this.age=args[0].age; } } else{ if(args[0]){ this.name=args[0]; } if(args[1]){ this.age=args[1]; } } } person.prototype.toString=function(){ console.log( "name="+this.name+"age+"+this.age); }; var bosn=new person('bson',24); bosn.toString(); var tian=new person({name:"tian",age:24}); tian.toString();查看全部
-
function person(name,age){ this.name=name; this.age=age; } person.prototype.hi=function(){ console.log("Hi my name is"+this.name+"dddddddddddd"); }; person.prototype.legs=2; person.prototype.arms=2; person.prototype.walk=function(){ console.log(this.name+"is walking....."); }; function student(name,age,className){ person.call(this,name,age); this.className=className; } student.prototype=Object.create(person.prototype); student.prototype.constructor=student; var bosn=new student('bosn',27,'class 3,grade 2'); bosn.hi(); bosn.walk();查看全部
-
typeof(null)返回object查看全部
-
类型检测方法查看全部
-
数据类型查看全部
-
。。。。查看全部
-
巧用+ -查看全部
-
修改prototype后,对已经创建的对象没有影响,但是影响后续创建的对象的值查看全部
举报
0/150
提交
取消