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 />
<a href="http://www.dotnetfunda.com">DotNetFunda</a>
<p id="demo"></p>
<script>
document.getElementById('demo').innerHTML = "Number of links in the page are :" + document.links.length;
</script>
We have given two links in the above code,
document.links.length identifies how many links are present in a page.
OUTPUT
Number of links in the page are :2