3

As I progress to teach myself JavaScript, an aspect comes to mind. Which function is faster and uses less memory of finding id's in an html?

I see this function very often but I've never used it:

document.getElementById("abc");

I use this everywhere in my Polymer app:

document.querySelector('#abc');

I hope I have not asked a silly question but few weeks ago I was reading an article and someone mentioned one is faster. Could someone explain if this is true please?

Sylar
  • 11,422
  • 25
  • 93
  • 166

0 Answers0