JavaScript Engine optimization during closure

lakbychance

Lakshya Thakur

Posted on January 8, 2021

JavaScript Engine optimization during closure

TIL that Javascript engines optimize out unused variables available in outer lexical environment if they aren't used inside nested functions.

Earlier I used to think this is the default Spec behaviour but it's rather an optimization 💡.

In this video, we see how exactly Firefox confirms that for us !!

💖 💪 🙅 🚩
lakbychance
Lakshya Thakur

Posted on January 8, 2021

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related