TGViewer
JavaScript JavaScript @javascript · 31K subscribers
Post #1991 6.68K
CHALLENGE

function getNextWeekday(dateString) {
const date = new Date(dateString);
const day = date.getDay();
const diff = (day === 0 ? 1 : 8) - day;
date.setDate(date.getDate() + diff);
return date.toDateString();
}

console.log(getNextWeekday('2023-10-20'));
  • ❤ 13
  • 👍 3
  • 🔥 3
  • 🤔 2
  • 🤩 1
More from @javascript
  1. Oct 11, 2026Post #3552
  2. Oct 11, 2026CHALLENGE const output = []; output.push(typeof foo); try { output.push(typeof bar); } cat…
  3. Oct 10, 2026Post #3550
  4. Oct 10, 2026CHALLENGE async function main() { const settled = await Promise.allSettled([ Promise.resol…
  5. Oct 9, 2026Post #3548
  6. Oct 9, 2026CHALLENGE const a = -7 % 3; const b = 7 % -3; const c = 2 ** 3 ** 2; const d = (2 ** 3) **…
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook →Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 →