mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-09-24 23:01:18 +08:00
fix(curriculum): remove explanation for textContent property (#53142)
Co-authored-by: Mama Naomi <nhcarrigan@gmail.com> Co-authored-by: Pratyansh Agrawal <erpratyansh@gmail.com> Co-authored-by: Krzysztof G. <60067306+gikf@users.noreply.github.com> Co-authored-by: Shivam Gupta <95732954+shivam-0510@users.noreply.github.com> Co-authored-by: jdwilkin4 <jwilkin4@hotmail.com> Co-authored-by: Jessica Wilkins <67210629+jdwilkin4@users.noreply.github.com> Co-authored-by: Huyen Nguyen <25715018+huyenltnguyen@users.noreply.github.com>
This commit is contained in:
co-authored by
Mama Naomi
Pratyansh Agrawal
Krzysztof G.
Shivam Gupta
jdwilkin4
Jessica Wilkins
Huyen Nguyen
parent
6b1462b428
commit
f5475414ed
-15
@@ -7,21 +7,6 @@ dashedName: step-14
|
||||
|
||||
# --description--
|
||||
|
||||
In JavaScript, the `textContent` property is used to both get and set the text of a node.
|
||||
|
||||
For example, here's how you can get the text content from a paragraph element with the id `example-paragraph`, and set its text content to a new value:
|
||||
|
||||
```html
|
||||
<p id="example-paragraph">Example Text</p>
|
||||
```
|
||||
|
||||
```js
|
||||
const exampleParagraph = document.getElementById("example-paragraph");
|
||||
console.log(exampleParagraph.textContent); // "Example Text"
|
||||
exampleParagraph.textContent = "New Text";
|
||||
console.log(exampleParagraph.textContent); // "New Text"
|
||||
```
|
||||
|
||||
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.
|
||||
|
||||
Reference in New Issue
Block a user