Skip to content

Missing "monthDays.innerHTML = days" in for loop #2

@austinginn

Description

@austinginn

Current:

for (let i = 1; i <= lastDay; i++) {
    if (i === new Date().getDate() && date.getMonth() === new Date().getMonth()) {
      days += `<div class="today">${i}</div>`;
      console.log("found current date: " + i );
    } else {
      console.log("adding day: " + i);
      days += `<div>${i}</div>`;
    }
  }

Corrected:

  for (let i = 1; i <= lastDay; i++) {
    if (i === new Date().getDate() && date.getMonth() === new Date().getMonth()) {
      days += `<div class="today">${i}</div>`;
      console.log("found current date: " + i );
    } else {
      console.log("adding day: " + i);
      days += `<div>${i}</div>`;
    }
    monthDays.innerHTML = days;
  }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions