Question · JavaScript and TypeScript course · Module 1: JavaScript Basics
Scope of let and const Variables
What scope do variables declared with let and const have?
Answer options
- Global - visible everywhere
- Module-level - visible throughout the file
- Block-scoped - visible only in the block { } where they were declared
- Function-scoped - visible throughout the entire function
Show the answer
Correct answer:
- Block-scoped - visible only in the block { } where they were declared