2 ms·
As long as it makes sense when you read it after a few days (i.e. its well organized) and it also works as expected, then you are probably doing well. Javascri
by bob1029 6y ago
As long as it makes sense when you read it after a few days (i.e. its well organized) and it also works as expected, then you are probably doing well.
Javascript is actually incredibly fast on most devices, especially if you are constraining yourself to the vanilla API and not something like jQuery. Remember, every web browser's JS engine has been hyper-optimized to support decades of half-assed website implementations.
It's really hard to screw up perf on document.getElementById(). There's honestly not a whole lot of ways to hang yourself with the vanilla methods unless you are trying to build something ridiculous like a raytracer or physics engine.
- azangru 6y ago> document.getElementById() Can we at least do document.querySelector? Pretty please? :-)
- snet0 6y agoJust use the 1 line jQuery: const $ = document.querySelector.bind(document)
- abhishekjha 6y agoWhat does it do?
- asddubs 6y agoi think the biggest thing for your average app is just causing a lot of layout repaints. as long as you spam requestanimationframe everywhere and group style changes and polling, you'll be good. I was really surprised how good I was able to get things on even an ancient ipad 2 I had laying around