JavaScript Getting Started With ES2015 Defining Variables With let and const Review let and const

Fernando Jimenez
PRO
Fernando Jimenez
Pro Student 6,997 Points

Whats the right answer here? Why can't they all be let or even const?

Whats the right answer here? Why can't they all be let or even const?

1 Answer

Steven Parker
Steven Parker
177,482 Points

When you say "here", which question are you referring to?

But if it's the one where you fill in the code, the correct choice can only be "let" for a variable that is assigned later. But for those that are initialized where they are declared and not changed later, "const" is preferred.