if (wx.getuserprofile){...}是什么语法,wx.getuserprofile是执行函数的意思吗?还是wx对象的属性?执行函数不用在后面加小括号吗?
if (wx.getUserProfile) {
console.log()
this.setData({
canIUseGetUserProfile: true
})
}
这是一种隐性的类型转换写法,意思是如果wx中包含属性getUserProfile,并且getUserProfile不是空值,则条件为真,执行if中的代码。
空值包含:false、0、空字符串、undefined、null。
空值包含:false、0、空字符串、undefined、null。
温馨提示:答案为网友推荐,仅供参考