js的get set, 建構函式,匿名函式,prototype(原型)
//js get set
ar obj = {
val:"",
get getval(){
return this.val;
},
set setval(x){
this.val = x;
}
};
obj.setval=50;
console.log(obj.getval);
//js 建構函式
function a(){
var num=1;
this.b=function(){
num++;
alert(num);
}
this.c=function c(){
alert("7777777777");
}
}
var A=new a();
A.c();
//js 匿名函式
(function(){
alert(5555);
})()
// 原型
function fn1(){
}
fn1.prototype.name="張三";
var a=new fn1();
alert(a.name)