if (wx.getuserprofile){...}是什么语法,wx.getuserprofile是执行函数的意思吗?

if (wx.getuserprofile){...}是什么语法,wx.getuserprofile是执行函数的意思吗?还是wx对象的属性?执行函数不用在后面加小括号吗?
if (wx.getUserProfile) {
console.log()
this.setData({
canIUseGetUserProfile: true
})
}

这是一种隐性的类型转换写法,意思是如果wx中包含属性getUserProfile,并且getUserProfile不是空值,则条件为真,执行if中的代码。
空值包含:false、0、空字符串、undefined、null。
温馨提示:答案为网友推荐,仅供参考

相关了解……

你可能感兴趣的内容

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 非常风气网