Scopes and closures encapsulate variables and functions from other methods in your code. They promote clean and secure coding practices like DRY (Don't Repeat Yourself) principles and data privacy.
In this video, I'll walk through the basics of scopes and closures in JavaScript. You'll get a deeper understanding of the global and local scope. In addition, you'll see a working example of lexical scoping.
I'll also show you one of the main differences between let and var variables in the language, and make a case why you should always use let over var.
🎬 Subscribe to the channel! - / @ijemmaonwuzulike
Timestamps:
0:00 Intro
0:30 What is Scope?
0:46 Global Scope
1:30 Local Scope
2:13 Why Are Scopes Important?
2:41 Lexical Scopes
3:34 let vs. var
5:11 Error Example
== Let's Connect ==
🐦 Twitter - / ijemmaohno
== Who I Am ==
I'm Ijemma, a frontend software engineer currently working in New York City. I make videos on all things JavaScript and, more broadly, frontend web development.
#javascript #webdevelopment #softwareengineer