-
树上是查看全部
-
这个地方的proto不应该是在prototype里面的吧,因为proto和prototype是同级的啊?查看全部
-
原始表达式:1.常量、直接量(3.14 ,"test")2.关键字(null,this,true)3.变量(i,k,j)查看全部
-
函数作用于,全局作用域,eval作用域。没有块作用域查看全部
-
1.typeof返回字符串查看全部
-
with 缺点:让JS引擎优化更难 可读性差 可被变量定义代替 严格模式下被禁用 (不建议使用) with(document.forms[0]){ console.log(name.value); } 相当于 var form = document.forms[0]; console.log(form.name.value);查看全部
-
for..in 顺序不确定 enumerable为false时不会出现 for in对象属性受原型链影响 var p; var obj = {x:1,y:2} for(p in obj){}查看全部
-
//模拟重载 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(){ return 'name=' + this.name + ',age=' + this.age; }查看全部
-
function Person(name, age){ this.name = name; this.age = age; } Person.prototype.hi = function(){ console.log("Hi,my name is " + this.name + ",I'm" + this.age + "years old now."); } Person.prototype.LEGS_NUM = 2; Person.prototype.ARMS_NUM = 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; Student.prototype.hi = function(){ console.log("Hi,my name is " + this.name + ",I'm" + this.age + "years old now,and from " + this.className + "."); } Student.prototype.learn = function(subject){ console.log(this.name + "is learning" + subject + "at" + this.className + "."); }查看全部
-
1、原始表达式 2、初始化表达式 3、函数表达式 4、属性访问表达式 5、调用表达式 6、对象创建表达式查看全部
-
等于运算符判断规则。有一边是boolean值,则把boolean值转换为number再判断,true转为1,false转为0;对象转为基本类型使用对象里面的valueof方法;尽量使用===与!==替代这种不规范的==与!=可以减少很多错误的发生查看全部
-
等于运算符判断规则。有一边是boolean值,则把boolean值转换为number再判断,true转为1,false转为0;对象转为基本类型使用对象里面的valueof方法;尽量使用===与!==替代这种不规范的==与!=可以减少很多错误的发生查看全部
-
严格等于查看全部
-
数据类型查看全部
-
32-‘32’=0查看全部
举报
0/150
提交
取消