1.写成返回值这种:
function re(){
let myname = 123
let set = {
'name' = function(name){
myname = name
}
}
let get = {
return myname
}
}
2.对象类
function re(){
this.myname = 123
this.set = {
'name' = function(name){
this.myname = name
}
}
this.get = {
'name' = function(){
return this.myname
}
}
}
var hh = new re().set.name('aaa');
alert(hh.get.name())
大家给我指点一下
绝地无双
相关分类