r/javascript • • Jul 11 '17

help What 10 Things Should a Serious Javascript Developer Know Right Now?

I'm inviting pure opinion here, but what's your list of ten things that everyone looking for a good javascript role should know and understand. Personally, I'm in a role where what I know is adequate, but I want to be somewhere better; somewhere that has some flippin standards. I'm learning outside of work requirements at the moment, but there is so much shit to learn out there.

The objective is to do good work in a good place.

Narrow it down to your ten for me, or for you.

Can be your own "I must learn x" list too. I'm very interested to hear what people think.

348 Upvotes

223 comments sorted by

View all comments

Show parent comments

3

u/Wooshception Jul 11 '17

I assumed the OP was referring to the W3C Selectors API, but their point applies to jQuery as well.

1

u/redshirt714 Jul 11 '17

Interesting, so at the end of the day, using the getElementByXX methods will be your fastest and best bet?

4

u/spryes Jul 12 '17 edited Jul 12 '17

The difference is completely negligible in virtually all cases. It doesn't even matter. I just did a test on 1000 querySelectorAlls, and it executed it in 2ms. 1 single animation frame on a 60 Hz device is 17ms.

Using a more complex DOM and selectors, it increases to 20ms (for 1000 selections). Which means for a regular-ish case of 1-10 different selections, it's less than 0.5ms. Unless you are placing it in a giant loop which you probably shouldn't be doing, go with what's easier.

1

u/redshirt714 Jul 12 '17

Thanks for taking the time to fully explain. It seems like in a lot of cases, things like accessing data and querying selectors only becomes an issue when things are either large or done a ton of times. In O(n) isn't bad in cases where the input size is small.