diff --git a/challenges/02-javascript-algorithms-and-data-structures/es6.json b/challenges/02-javascript-algorithms-and-data-structures/es6.json
index f0084c6c1d..2d24982c73 100644
--- a/challenges/02-javascript-algorithms-and-data-structures/es6.json
+++ b/challenges/02-javascript-algorithms-and-data-structures/es6.json
@@ -25,20 +25,21 @@
},
{
"id": "587d7b87367417b2b2512b3f",
- "title": "Explore Problems with the var Keyword",
+ "title": "Explore Differences Between the var and let Keywords",
"description": [
"One of the biggest problems with declaring variables with the var
keyword is that you can overwrite variable declarations without an error.",
"
var camper = 'James';", - "In a small application, you might not run into this type of problem, but when your code becomes larger, you might accidently overwrite a variable that you did not intend to overwrite. Because this behaviour does not throw an error, searching and fixing bugs becomes more difficult.", - "Another problem with the
var camper = 'David';
console.log(camper);
// logs 'David'
var
keyword is that it is hoisted to the top of your code when it compiles. This means that you can use a variable before you declare it.",
- "console.log(camper);", - "The code runs in the following order:", - "
var camper = 'David';
// logs undefined
camper
is declared as undefined.camper
is logged.camper
.let
was introduced in ES6 to solve the problems with the var
keyword. With the let
keyword, all the examples we just saw will cause an error to appear. We can no longer overwrite variables or use a variable before we declare it. Some modern browsers require you to add \"use strict\";
to the top of your code before you can use the new features of ES6.",
- "Let's try using the let
keyword.",
+ "As you can see in the code above, the camper
variable is originally declared as James
and then overridden to be David
.",
+ "In a small application, you might not run into this type of problem, but when your code becomes larger, you might accidently overwrite a variable that you did not intend to overwrite.",
+ "Because this behavior does not throw an error, searching and fixing bugs becomes more difficult.let
was introduced in ES6 to solve this potential issue with the var
keyword.",
+ "If you were to replace var
with let
in the variable declarations of the code above, the result would be an error.",
+ "let camper = 'James';", + "This error can be seen in the console of your browser.", + "So unlike
let camper = 'David'; // throws an error
var
, when using let
, a variable with the same name can only be declared once.",
"var
with let
"
+ "Update the code so it only uses the let
keyword.",
+ "Notelet
prevents variables from being overridden, you will need to remove one of the declarations entirely."
],
"challengeSeed": [
"var catName;",