Click on <a> link that doesn't jump to the top of the page

When user will click on the <a href="#x"> it won't jump to the top of the page. The secret is in the href value it should be value (id) that doesn't exists on the page e.g. href="#x"

by Konstantin Rouda

HTML

<p>
text in paragraph
</p>

<a href="#x">LINK</a>

<p>
text in paragraph
</p>

<p>
text in paragraph
</p>

<p>
text in paragraph
</p>

<p>
text in paragraph
</p>

JavaScript

var docFrag = document.createDocumentFragment();
var firstP = document.querySelector("p");

for(var i = 0; i < 100; i++) {
   var p = document.createElement("p");
    p.innerText = (i + 1) + ")" + "inner text for the paragraph";
    docFrag.appendChild(p);
}


document.body.insertBefore(docFrag, firstP);