[英]convert variable of ternary operator to if-else statement
x = (year % 100 === 0) ? (year % 400 === 0) : (year % 4 === 0);
alert(x);
hi guys, how can I convert this variable x to if-else statement returning the variable in true or false result? 嗨,大家好,如何将这个变量x转换为if-else语句,以返回true或false结果的变量?
thanks a lot 非常感谢
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);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.