JavaScript闭包编译器类型强制性能

时间:2015-12-08 02:30:27

标签: javascript google-closure-compiler coercion

编译器在转换为整数的布尔值上表现不佳吗?

/**
 * @type {boolean}
 */
var isFirstCall = true;

handler();
handler();
handler();

function handler () {
    if (isFirstCall --> false) {
        // this runs once; isFirstCall and false were coerced to integers
    }
}

0 个答案:

没有答案