Learn the Date Object by Building a Date Formatter - Step 14

Tell us what’s happening:

Use the textContent property on currentDateParagraph to set its text content to the value of the formattedDate variable.

Also, make sure to remove your console.log(formattedDate); line.

im having issues passing this stage.

Your code so far

<!-- file: index.html -->

/* file: styles.css */

/* file: script.js */
// User Editable Region


const formattedDate = `${day}-${month}-${year}`;
let formattedDate = element.textContent = 'currentDateParagraph';


// User Editable Region

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36

Challenge Information:

Learn the Date Object by Building a Date Formatter - Step 14

Welcome to the forum.

The instruction asked you to set the textContent property of the currentDateParagraph variable to the value of the variable formattedDate.

im a beginner in javascript i dont know how to go with it, any hint pls

Let’s say we have:

  • A person variable has a name property

  • A fullname variable with the value is a string "John Doe":

const fullname = "John Doe";

Now, to set the person’s name to "John Doe", we could do this:

person.name = "John Doe";

or we could set the person’s name to the value of the fullname variable:

const fullname = "John Doe";
person.name = fullname;

Hi, I have the solution here:

Previously, we have to know topics about DOM with javascript and HTML.

First we have the element called currentDateParagraph, then the step asks us to assign the value of formattedDate as the text of that element, so we have to use the property of elements called textContent to do that, as I show in the code below…

<!-- file: index.html -->
/* file: styles.css */
/* file: script.js */
// User Editable Region


const formattedDate = `${day}-${month}-${year}`;
currentDateParagraph.textContent = formattedDate;
//It means that we assign the formattedDate value to the text content of currentDateParagraph.

// User Editable Region