Replace an element

Report a typo

There is a link on the webpage:

<a id="news" href="#">The best places to visit in France</a>

You need to replace it with the new one that is created below:

let link = document.getElementById("news");
let newLink = document.createElement("a");
newLink.textContent = "Tourist attractions in Paris";

Use the existing variables and a single line of code.

Enter a short text
___

Create a free account to access the full topic