我该如何解决有条件的OR问题

时间:2019-09-18 06:43:18

标签: javascript

我希望the年和第二年为“ 22”,其余为“ 23”。

var hdag =(((Date.isLeapYear(year)||(Date.isLeapYear(year)+1))?“ 23”:“ 22”)+“ / 9”;

1 个答案:

答案 0 :(得分:0)

我不确定您要怎么做,因为问题是用奇怪的方式写的,但是请尝试以下操作:

let thisYear = (Date.isLeapYear(year)) ? "22" : "23") + "/9",
    nextYear = thisYear


console.log(`This year is ${thisYear}, and next year is ${nextYear}`)