DOM elements have a
that allows you to read the text of those elements.
Let's look at an example. Let's say we have the
Get a reference to this tag into a variable:
let elem = document.querySelector('#elem');
Read the tag text:
Change the tag text:
elem.textContent = '!!!';
Given a paragraph and a button. By clicking on the button, read the text of the paragraph and output it to the console.
Given a paragraph and a button. By clicking on the button, write a new text into the paragraph.
Given two paragraphs containing some numbers in their text, and a button. By pressing the button, display the sum of the stored numbers.
Given three paragraphs with numbers, a div, and a button. By pressing the button, write down the sum of numbers in the text of the div.
Given a paragraph with a number and a button. By clicking on the button, add one to the paragraph value and write the resulting number back.
Given a paragraph with text and a button. After pressing the button, write an exclamation mark at the end of the paragraph text.