0

这段代码是动态改变条件的,但是,这个语句被chrome识别和干预,而不是fx,如何解决这个问题?谢谢

if a % 2 == 0 
  var condition = b == c  || b == d;
else 
  var condition = b == e  || b == f ;

if (condition)
  ......
4

2 回答 2

4
var condition = (a % 2 == 0) ? (b == c  || b == d) : (b == e  || b == f);
于 2013-02-03T13:41:23.797 回答
0

像这样写:

var condition;
if (a % 2 == 0)
    condition = b == c  || b == d;
else 
    condition = b == e  || b == f ;

if (condition)
   ......
于 2013-02-03T13:41:50.310 回答