( function(x){return x*x;} ) ( 3 ) // 9
document.querySelectorAll()
настоящий массив — потому, что понадобится его метод forEach()
const D = new Date(ts);
const now = new Date();
D.setFullYear( now.getFullYear());
D.setMonth( now.getMonth());
D.setDate( now.getDate());
if (D > now) D.setDate( now.getDate() - 1);