1.
var Person = function(_name, _age){
this.name = _name;
this.age = _age;
};
2.
var Person = function(_name, _age){
return {
name: _name,
age: _age
}
};
3.
// 匿名類別
var p = (function(){
return {
name: _name,
age: _age
};
}());
4.
// 隔空發功建立物件
var p;
(function(){
p = {
name: _name,
age: _age
};
}());
沒有留言:
張貼留言