const contentString = "Hello, world";
document.body.innerHTML = contentString.anchor("hello");String.prototype.anchor() / notebook
String.prototype.anchor()
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.
<a name="hello">Hello, world</a>const contentString = "Hello, world";
const elem = document.createElement("a");
elem.innerText = contentString;
document.body.appendChild(elem);