Reputation: 161
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?
thanks a lot
Upvotes: 0
Views: 37
Reputation: 28564
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);
Upvotes: 1