Basic JavaScript - Explore Differences Between the var and let Keywords

Tell us what’s happening:
I don’t understand why we replace var with let

Your code so far

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

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36

Challenge: Basic JavaScript - Explore Differences Between the var and let Keywords

Link to the challenge:

Generally, it is best to declare a variable using let instead of var for various reasons. For further explanation of the benefits of let over it var relative, you could take a look at the article below:

I think the purpose of this excise is to introduce you to using one keyword over the other.

2 Likes

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.