[英]convert variable of ternary operator to if-else statement
x = (year % 100 === 0) ? (year % 400 === 0) : (year % 4 === 0);
alert(x);
嗨,大家好,如何將這個變量x轉換為if-else語句,以返回true或false結果的變量?
非常感謝
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.