Affichage du mois et de l'année dans un calendrier en JavaScript

Dans les leçons précédentes, nous avons créé le calendrier qui servait d'exemple dans la première leçon. Améliorons-le maintenant.

Pour commencer, faisons en sorte qu'au-dessus du calendrier s'affiche le mois et l'année en cours. Apportons les modifications correspondantes dans le code HTML :

html<div id="parent">
  <div id="calendar">
    <div class="info">Jan 2020</div>
    <table>
      <thead>
        <tr>
          <th>lun</th>
          <th>mar</th>
          <th>mer</th>
          <th>jeu</th>
          <th>ven</th>
          <th>sam</th>
          <th>dim</th>
        </tr>
      </thead>
      <tbody class="body"></tbody>
    </table>
  </div>
</div>

Apportons également des modifications dans le code CSS :

css#parent {
  text-align: center;
}
#calendar {
  display: inline-block;
}
#calendar td, #calendar th {
  padding: 10px;
  border: 1px solid black;
  text-align: center;
}

#calendar .info {
  text-align: center;
}
Задание 1

Mettez en œuvre l'affichage du mois et du jour en cours comme décrit.