x = (year % 100 === 0) ? (year % 400 === 0) : (year % 4 === 0);
alert(x);
大家好,如何将此变量x转换为if-else语句,以true或false结果返回变量?
非常感谢
答案 0 :(得分:1)
year = 2010;
if(year % 100 === 0)
x = (year % 400 === 0);
else
x = (year % 4 === 0);
alert(x);
if(year % 100 === 0)
x = (year % 400 === 0);
else
x = (year % 4 === 0);
alert(x);