JavaScript में लिंक्स की संख्या प्राप्त करने के लिए, लिंक्स का उपयोग करें लंबाई . के साथ संपत्ति संपत्ति।
उदाहरण
दस्तावेज़ में लिंक की संख्या प्रदर्शित करने के लिए आप निम्न कोड चलाने का प्रयास कर सकते हैं -
<!DOCTYPE html>
<html>
<body>
<a href="https://www.tutorialspoint.com/php">PHP</a>
<br>
<a href="https://www.tutorialspoint.com/java/">Java</a>
<br>
<a href="https://www.tutorialspoint.com/html5/">HTML</a>
<br>
<a href="https://www.tutorialspoint.com/css/">CSS</a>
<script>
var val = document.links.length;
document.write("<br>Number of links in the document: "+val);
</script>
</body>
</html>