【发布时间】:2012-07-02 16:25:42
【问题描述】:
在ExtJS web desktop demo的示例代码中有如下调用:
this.setActiveButton(activeWindow && activeWindow.taskButton);
到方法:
setActiveButton: function(btn) {
if (btn) {
btn.toggle(true);
} else {
this.items.each(function (item) {
if (item.isButton) {
item.toggle(false);
}
});
}
}
函数调用中&&的作用是什么?
【问题讨论】:
-
@TheZ 在 JavaScript 中并不准确。
&&的值不一定是布尔值。它可以是任何东西。
标签: javascript extjs extjs4