In order to find out how many links are present in the HTML page we use document.links.length
<a href="http://www.techfunda.com">TechFunda</a><br />
document.getElementById('demo').innerHTML = "Number of links in the page are :" + document.links.length;
We have given two links in the above code, document.links.length
identifies how many links are present in a page.
Number of links in the page are :2