标签:
function createObject(name,age){
var obj = new Object();
obj.name = name;
obj.age = age;
obj.run = function(){
return this.name + this.age + ‘运行中‘;
};
return obj;
}
var box1 = createObject(‘Lee‘, 100); //第一个实例
var box2 = createObject(‘Jack‘, 200); //第二个实例
alert(box1.run());
alert(box2.run());
alert(typeof box1);
alert(box1 instanceof Object);
标签:
原文地址:http://www.cnblogs.com/oksite/p/4699505.html