const number =(' ')
↑この中に入れてstringに変えていきます。
const number =(${year}${month}${day}
)
この年月日を変えていきます。
const number =(${
0000+year.slice(4)}${month}${day}
)
このような形ですね。
.slice(-length)-をする意味は 00+2 の時 002となり、必要な部分を抜き取るためです。
002.slice(-2)は 02 になります。