View Code
function get(){
alert(this.username+" : "+this.password);
}
function createObject(userName,pwd){
var obj=new Object();
obj.username=userName;
obj.password=pwd;
obj.get=get;
return obj;
}
var object=createObject("小张","男");
//object.get();
//这里new出来的object的对象并不是最顶层的ojbect对象
function person(){
}
var per=new person();
alert(typeof per.get);
per.get();