function endOfWeek(date) { const lastday = date.getDate() - (date.getDay() - 1) + 6; return new Date(date.setDate(lastday)); } const dt = new Date(); console.log(endOfWeek(dt).toString());
function endOfWeek(date) { const lastday = date.getDate() - (date.getDay() - 1) + 6; return new Date(date.setDate(lastday)); } const dt = new Date(); console.log(endOfWeek(dt).toString());