标签:
引自《JavaScript权威指南》第6.4章,对原示例略有改动,以示区别。
var o = {x:0}; if (o.x != null) o.x += 2; console.log(o); var o = {x:0}; if (o.x) o.x += 2; console.log(o);
检查属性时候的区别
原文地址:http://www.cnblogs.com/lixiaoyaoslove/p/4261310.html