//构造函数
function Box(name,age){
this.name=name;
this.age=age;
this.run=function(){
return this.name+'--'+this.age;
}
}
var box1= Box('gao',23);//我是一个对象
var box2=new Object();
Box.call(box2,'chen','24'); 对象冒充
console.log(box2 instanceof Object);//冒充后我依然从属于Object对象
console.log(box2 instanceof Box);//冒充后我并不从属于与Box <form action="save.php" method="post" target="nm_iframe"> &nbs...
<!DOCTYPE html> <html> <head> <title></title> <meta charset="utf-8"> </head> <body>...
//字面量的形式创建原型对象 /* function Box(){} Box.prototype={ 'name':'gao', age:23, fun:function(){ return this.name+'--'+...
//原型的缺点 function Box(){} Box.prototype={ 'name':'gao', age:23, family:['哥哥','姐姐','妹妹'], &...
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>点击复制</title> </head>...
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>录制</title> <script ...