Does querySelector use up more resources or take longer than using the other selectors getElementById, or getElementsByClassName?
Ivan Chwalik92 Points
console.time("QuerySelector"); document.querySelector('#firstDiv'); console.timeEnd("QuerySelector"); console.time("GetByID"); document.getElementById('firstDiv'); console.timeEnd("GetByID");
Checking the console in Microsoft Edge DevTools reveals the result: QuerySelector: 0.067138671875 ms GetByID: 0.01708984375 ms
Note that these speeds can change depending on many, many other factors. You'll never get the same result, but you will notice that getElementById is faster.