Pergunta de entrevista da empresa Google

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.

Resposta da entrevista

Sigiloso

31 de jan. de 2019

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.