2020年12月27日解決済み

当日を太字にする処理について教えて下さい

ユーザー

if (year === today.getFullYear() && month === today.getMonth())
こちらのコードですが、
let year = today.getFullYear
let month = today.getMonth();
としているので、
year === today.getFullYear() やmonth === today.getMonth()としなくても
すでにyearとmonthは当日の年月がとれているのではないかと考えたのですが、
なぜこのような記述になるのでしょうか?
単純にてif(year && month)でyearがtrueかつmonthがtrueというように表現できないのでしょうか?

スタッフ

この回答を見るにはプレミアムプランへの登録が必要です

プレミアムプランとは?