Error: Explore Differences Between the var and let Keywords

Tell us what’s happening:

It looks like this lesson is confusing ‘let’ and ‘const’.
“So unlike var , when you use let , a variable with the same name can only be declared once.”

Your code so far


let catName = "Oliver";
let catSound = "Meow!";

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.99 Safari/537.36

Challenge: Explore Differences Between the var and let Keywords

Link to the challenge:

I disagree.

Isnt that what is happening?

catName and catSound are obviously two different variable names. If you try redefining them again with let you will see an error.

If you do this with var instead of let you will notice that it doesnt throw an error.

2 Likes