0d: 00h: 00m: 00s

🎁 Get 3 extra months of learning β€” completely FREE

That's 90 extra days to master new skills, build more projects, and land your dream job.

Become a PRO
Background Image

🎁 Get 3 extra months of learning completely FREE

Become a PRO
Tony Stark
2 months ago
Tonycountry asked

In JavaScript, why do we use let?

Abhay Jajodia
Expert
yesterday
Abhay Jajodia answered

Hi Tony Stark,

let is used to create a variable in JavaScript. It tells JavaScript to make a new named place to store a value.

Example:

let greeting = "Merry Christmas";

Now greeting holds that text, and you can use it later, or even change it:

greeting = "Happy New Year";

let is also block-scoped, meaning it only works inside the { } block where you created it, which helps avoid bugs.

If you have more questions, I am here to help 😊

JS
This question was asked as part of the Learn JavaScript Basics course.