Javascript for-in Statement on DOM Nodes
<html> <body> <a href="www.cnn.com" id="hreflink">Hello</a><br /> <script> let myLink = document.getElementById("hreflink"); for (info in myLink) {/*from ww w .j a v a2s. co m*/ console.log(info + "-" + myLink[info] ); } </script> </body> </html>