diff --git a/challenges/basic-javascript.json b/challenges/basic-javascript.json
index 7aac971929..639c559a05 100644
--- a/challenges/basic-javascript.json
+++ b/challenges/basic-javascript.json
@@ -1333,12 +1333,13 @@
" ",
" // Only change code above this line.",
" ",
- " $(\".logger\").html(\"\");",
- " $(\".logger\").html(\"Not A Win\")",
" ",
" if (slotOne !== undefined && slotTwo !== undefined && slotThree !== undefined) {",
" $(\".logger\").html(slotOne + \" \" + slotTwo + \" \" + slotThree);",
" }",
+ " ",
+ " ",
+ " $(\".logger\").append(\" Not A Win\")",
" return [slotOne, slotTwo, slotThree];",
" }",
"",
@@ -1460,13 +1461,14 @@
"title": "Add your JavaScript Slot Machine Slots",
"description": [
"Now that our slots will each generate random numbers, we need to check whether they've all returned the same number.",
- "If they have, we should notify our user that they've won.",
- "Otherwise, we should return null
, which is a JavaScript data structure that means nothing.",
- "If all three numbers match, we should return the number that we have in three of slots or leave it as null
.",
- "Let's create an if statement
with multiple conditions in order to check whether all numbers are equal.",
- "if (slotOne !== slotTwo || slotTwo !== slotThree) {
",
+ "If they have, we should notify our user that they've won and we should return null
.",
+ "null
is a JavaScript data structure that means nothing.",
+ "The user wins when all the three numbers match. Let's create an if statement
with multiple conditions in order to check whether all numbers are equal.",
+ "if(slotOne === slotTwo && slotTwo === slotThree){
",
" return null;
",
- "}
"
+ "}
",
+ "Also, we need to show the user that he has won the game when he gets the same number in all the slots.",
+ "If all three numbers match, we should set the text \"It's A Win\"
to the element with class logger
or leave it as it is."
],
"tests": [
"assert((function(){var data = runSlots();return data === null || data.toString().length === 1;})(), 'If all three of our random numbers are the same we should return that number. Otherwise we should return null
.')"
@@ -1484,8 +1486,6 @@
" slotTwo = Math.floor(Math.random() * (3 - 1 + 1)) + 1;",
" slotThree = Math.floor(Math.random() * (3 - 1 + 1)) + 1;",
" ",
- " $(\".logger\").html(\"\");",
- " $(\".logger\").html(\"Not A Win\");",
" ",
" // Only change code below this line.",
" ",
@@ -1493,11 +1493,12 @@
" ",
" // Only change code above this line.",
" ",
- " if (slotOne !== undefined && slotTwo !== undefined && slotThree !== undefined) {",
- " $(\".logger\").html(slotOne);",
- " $(\".logger\").append(\" \" + slotTwo);",
- " $(\".logger\").append(\" \" + slotThree);",
+ " if(slotOne !== undefined && slotTwo !== undefined && slotThree !== undefined){",
+ " $(\".logger\").html(slotOne + \" \" + slotTwo + \" \" + slotThree);",
" }",
+ " ",
+ " $(\".logger\").append(\" Not A Win\");",
+ " ",
" return [slotOne, slotTwo, slotThree];",
" }",
"",
@@ -1622,7 +1623,7 @@
"Let's use the jQuery selector
$(\".slot\")
to select all of the slots.",
"Once they are all selected, we can use bracket notation
to access each individual slot:",
"$($(\".slot\")[0]).html(slotOne);
",
- "This jQuery will select the first and update the slot's HTML to display the correct number.",
+ "This jQuery will select the first slot and update it's HTML to display the correct number.",
"Use the above selector to display each number in its corresponding slot."
],
"tests": [
@@ -1642,8 +1643,6 @@
" slotTwo = Math.floor(Math.random() * (3 - 1 + 1)) + 1;",
" slotThree = Math.floor(Math.random() * (3 - 1 + 1)) + 1;",
" ",
- " $(\".logger\").html(\"\");",
- " $(\".logger\").html(\"Not A Win\")",
" ",
" // Only change code below this line.",
" ",
@@ -1652,15 +1651,17 @@
" // Only change code above this line.",
" ",
" if (slotOne === slotTwo && slotTwo === slotThree) {",
- " return slotOne;",
+ " $(\".logger\").html(\" It's A Win\")",
+ " return null;",
" }",
" ",
- " if (slotOne !== undefined && slotTwo !== undefined && slotThree !== undefined) {",
- " $(\".logger\").html(slotOne);",
- " $(\".logger\").append(\" \" + slotTwo);",
- " $(\".logger\").append(\" \" + slotThree);",
+ " if(slotOne !== undefined && slotTwo !== undefined && slotThree !== undefined){",
+ " $(\".logger\").html(slotOne + \" \" + slotTwo + \" \" + slotThree);",
" }",
" ",
+ " $(\".logger\").append(\" Not A Win\");",
+ " ",
+ " ",
" return [slotOne, slotTwo, slotThree];",
" }",
"",
@@ -1811,8 +1812,6 @@
" slotTwo = Math.floor(Math.random() * (3 - 1 + 1)) + 1;",
" slotThree = Math.floor(Math.random() * (3 - 1 + 1)) + 1;",
" ",
- " $('.logger').html('');",
- " $('.logger').html('Not A Win');",
" ",
" // Only change code below this line.",
" ",
@@ -1821,15 +1820,16 @@
" // Only change code above this line.",
" ",
" if (slotOne === slotTwo && slotTwo === slotThree) {",
- " return slotOne;",
+ " $('.logger').html(\"It's A Win\");",
+ " return null;",
" }",
" ",
- " if (slotOne !== undefined && slotTwo !== undefined && slotThree !== undefined) {",
- " $('.logger').html(slotOne);",
- " $('.logger').append(' ' + slotTwo);",
- " $('.logger').append(' ' + slotThree);",
+ " if(slotOne !== undefined && slotTwo !== undefined && slotThree !== undefined){",
+ " $(\".logger\").html(slotOne + \" \" + slotTwo + \" \" + slotThree);",
" }",
" ",
+ " $('.logger').append(\" Not A Win\");",
+ " ",
" return [slotOne, slotTwo, slotThree];",
" }",
"",