Explore Differences Between the var and let Keywords
Problem Explanation
We need to change each var
to let
in our code.
Hints
Hint 1
- Find each
var
and replace withlet
.
Solutions
Solution 1 (Click to Show/Hide)
let catName;
let quote;
function catTalk() {
"use strict";
catName = "Oliver";
quote = catName + " says Meow!";
}
catTalk();
Code Explanation
By using let
instead of var
we can avoid overriding catName
and quote
.