此代码是动态更改条件的,但是,此语句是由chrome识别和解释但不是fx,如何解决问题?感谢
if a % 2 == 0
var condition = b == c || b == d;
else
var condition = b == e || b == f ;
if (condition)
......
答案 0 :(得分:4)
var condition = (a % 2 == 0) ? (b == c || b == d) : (b == e || b == f);
答案 1 :(得分:0)
像这样写:
var condition;
if (a % 2 == 0)
condition = b == c || b == d;
else
condition = b == e || b == f ;
if (condition)
......