r/javascript • • May 28 '19

What are some JavaScript things beginners don't know?

333 Upvotes

383 comments sorted by

View all comments

105

u/ItalyPaleAle May 28 '19

The async programming model and especially how the event loop works.

The latter might be transparent to you 99.9% of the times, but then you’ll run into issues where your code behaves unexpectedly and you just need to execute it in the next tick (iteration of the event loop) instead.

12

u/ThatBriandude May 28 '19 edited May 28 '19

and you just need to execute it in the next tick (iteration of the event loop) instead.

I consider myself pretty well versed in javascript however I can not imagine what you mean with this. How would "execute it in the next tick" look in code?

9

u/robotslacker May 28 '19

Check out the video below. I didn’t really understand the event loop until this. The presenter does a really good job explaining and visualizing it.

https://youtu.be/8aGhZQkoFbQ