Let vs. Var: Understanding the Differences in JavaScript - Coding Interview Prep

Опубликовано: 26 Март 2026
на канале: Jesse Weigel
268
19

What is the difference between let and var in JavaScript?
In JavaScript, the let keyword is used to declare a block-scoped variable, while the var keyword is used to declare a function-scoped variable. This means that variables declared with let are only accessible within the block of code in which they are defined, while variables declared with var are accessible within the entire function in which they are defined.

Check me out on:
Twitter:   / jesserweigel  
Instagram:   / jesse.weigel  
freeCodeCamp:    / freecodecamp