There is such code:
let l = document.getElementsByTagName("a"); for (k in l){ l[k].onclick = function(){ alert(this.href); return false; } } It should output the address of the link, I get undefined. Tried it like this:
let l = document.getElementsByTagName("a"); for (k in l){ l[k].onclick = function(){ alert(l[k].href); return false; } } The result is the same. Tell me what am I doing wrong?