diff --git a/seed/challenges/basic-javascript.json b/seed/challenges/basic-javascript.json
index 3c42feeeaf..5aa5b7549e 100644
--- a/seed/challenges/basic-javascript.json
+++ b/seed/challenges/basic-javascript.json
@@ -1332,12 +1332,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];",
" }",
"",
@@ -1459,13 +1460,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 also set the text \"It's A Win\"
to the element with class logger
."
],
"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
.')"
@@ -1483,8 +1485,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.",
" ",
@@ -1492,11 +1492,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];",
" }",
"",
@@ -1621,7 +1622,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": [
@@ -1641,8 +1642,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.",
" ",
@@ -1651,15 +1650,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];",
" }",
"",
@@ -1810,8 +1811,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.",
" ",
@@ -1820,15 +1819,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];",
" }",
"",