JSFiddle - React, Tailwind, and code Playground
HTML
<a href="http://www.google.com">google</a>
<a href="http://www.microsoft.com">ms</a>
<a href="http://www.yahoo.com">yahooa>
JavaScript
var allLinks = document.evaluate(
'//a[@href]',
window.document,
null,
XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,
null);
alert(allLinks.snapshotLength);