在比较运算中使用函数

在比较运算符两边的“数”用立即调用函数代替

示例

    var hasPassed = (function () {
            var pass = 50;
            var psss = 2;
            return pass * psss;
        }())
        >=
        (function () {
            var score = 90;
            return score;
        }())
    document.write(hasPassed)

  

原文地址:https://www.cnblogs.com/max-hou/p/8891648.html