Beginner JavaScript
Q34 / 100

What is the difference between let, const, and var?

Correct! Well done.

Incorrect.

The correct answer is B) var is function-scoped and hoisted; let is block-scoped and reassignable; const is block-scoped and not reassignable

B

Correct Answer

var is function-scoped and hoisted; let is block-scoped and reassignable; const is block-scoped and not reassignable

Explanation

const prevents reassignment (not mutation). let and const are block-scoped with TDZ. var is function-scoped and should be avoided.

Progress
34/100