the error I am getting from chrome console is:
Uncaught TypeError: document.getElementsByTagname is not a function at tagsName
I understand getElementsByTagName returns HTML collection (kind of an array). But I am seeing an error consistently.
This is what you've written
document.getElementsByTagname
Rather the 'N' in the name should be capitalized
document.getElementsByTagName