Pergunta de entrevista da empresa Walgreens

Why does Javascript have two ways of getting HTML elements for example one way is to use getElementByID and another is document.[element].[value]

Resposta da entrevista

Sigiloso

14 de abr. de 2012

getElementByID is just a DOM method that provides a shortcut to get to the element its ID attribut. The same element is still located in the DOM tree and can be accessed if we know his full path. There are more than 2 ways: by class name by tag name etc...