+ 6

querySelector vs getElementsByClassName

Why document.querySelector and document.querySelectorAll methods are quite slow than document.getElementById, document.getElementsByClassName, document.getElementsByTagName ones? Is it still actual nowadays? Who can provide evidence, guys?đŸ€”

6th May 2019, 8:43 AM
Вап
1 Answer
+ 2
1. document.querySelector(".cname"); 2. document.getElementsByClassName("cname"); The faster one is faster for milli seconds!
6th May 2019, 1:50 PM
CodeFu
CodeFu - avatar