function createbook(name,time,type){
var o = new Object();
o.name = name;
o.time = time;
o.type = type;
o.getName = function(){
console.log(this.name)
};
return o;
}
var book1 = createbook("js book",2014,"js")
var book2 = createbook("css book",2013,"js")
book1.getName();
book2.getName();
function createPop(type,text){
var o = new Object();
o.content = text;
o.show = function(){
};
if(type == 'alert'){
console.log("alert --")
}
if(type == 'prompt'){
console.log('prompt --')
}
if(type == 'confirm'){
console.log("confirm --")
}
return o;
}
var userNameAlert = createPop('prompt','用户名只能是26个字母和数字')
var Basktball = function(id,name,price){
this.name = name;
this.id=id;
this.price = price;
var ids ="1";
function checkdId(){
};
Basktball.ischinese = "ffff";
Basktball.resettime = function(){
console.log("new Time")
}
}
Basktball.prototype = {
isJSBook: false,
display:function(){
}
}
var b = new Basktball(1,'篮球',40)
console.log(b.name)
console.log(b.id)
console.log(b.price)
console.log(b.ischinese + ":静态公有属性,对象访问不对静态公有方法")
console.log(Basktball.ischinese+" :静态公有方法类本身可以访问")
console.log(b.ids+":私有属性外部访问不到")
console.log(b.isJSBook+" :公有属性配置在原型上外部可访问 ")
console