Difference between revisions of "DOM Calendar"

From ProgZoo
Jump to navigation Jump to search
Line 5: Line 5:
<pre class=usr>
<pre class=usr>
let today = new Date();
let today = new Date();
document.body.innerText = `
document.body.innerHTML = `
${today.toLocaleDateString('en',{weekday:'long'})} <br>
${today.toLocaleDateString('en',{weekday:'long'})} <br>
`;
`;
Line 12: Line 12:
<pre class=ans>
<pre class=ans>
let today = new Date();
let today = new Date();
document.body.innerText = `
document.body.innerHTML = `
${today.toLocaleDateString('en',{weekday:'long'})} <br>
${today.toLocaleDateString('en',{weekday:'long'})} <br>
${today.toLocaleDateString('en',{month:'long'})} <br>
${today.toLocaleDateString('en',{month:'long'})} <br>

Revision as of 21:25, 1 January 2022


Display dates as specified

  • Show today's date, day of the week.
let today = new Date();
document.body.innerHTML = `
${today.toLocaleDateString('en',{weekday:'long'})} <br>
`;
let today = new Date();
document.body.innerHTML = `
${today.toLocaleDateString('en',{weekday:'long'})} <br>
${today.toLocaleDateString('en',{month:'long'})} <br>
${today.toLocaleDateString('fr',{weekday:'long'})} <br>
${today.toLocaleDateString('fr',{month:'long'})} <br>
`;