This site is mobile accessible. Press the "Tap Here" button to use a smaller font-size.



Smartphone icons created by Freepik - Flaticon

JS HTML DOM

Hello World!

Hello Norway!

// construct myCollection
const myCollection = document.getElementsByTagName("p");

// Copy second paragraph into p.demo
document.getElementById("demo").innerHTML = "The innerHTML of the second paragraph is: " + myCollection[2].innerHTML;

Note: The index starts at 0. I have an initial paragraph (p[0]) that is only visible on small devices so the code had to be adjusted to reflect this.