allusers:{"P01":"张三","P02":"李四","P03":"王五"}
getusername(xxx){
console.log(this.allusers.xxx) //结果是undefined
}
如何根据变量xxx获得对应的属性值呢?
getusername("P03") 就打印王五?
allusers:{"P01":"张三","P02":"李四","P03":"王五"}
getusername(xxx){
console.log(this.allusers.xxx) //结果是undefined
}
如何根据变量xxx获得对应的属性值呢?
getusername("P03") 就打印王五?
2 个回复
陌上华年
晓寒1987 - 相濡以沫不如相忘于江湖
前边不要引号的