Using JS Browser DOM API available functions, write "getElementsByClassName(className)" which accepts a string className and returns a list of HTML Elements which have the required className.
Anónimo
I used tree traversal on the document tree and maintained a list of elements, which gets returned. The answer was simple and short, and the interviewer did not ask for any further questions about my answer.