diff --git a/challenges/basic-javascript.json b/challenges/basic-javascript.json
index 21911500fe..fd12dfcf42 100644
--- a/challenges/basic-javascript.json
+++ b/challenges/basic-javascript.json
@@ -636,9 +636,9 @@
"In JavaScript we can divide up our code into separate and reusable parts called functions",
"here's and example of a function",
"",
- "function functionName (a, b){",
- " return(a + b);",
- "}",
+ "function functionName (a, b){",
+ " return(a + b);",
+ "}",
"
",
"our function can be called like this",
"functionName();
",
@@ -1069,6 +1069,152 @@
"})();(function(){return(test);})();"
],
"challengeType": 1
+ },
+ {
+ "id":"cf1111c1c12feddfaeb9bdef",
+ "name":"Creating a slots machine",
+ "dashedName":"creating-a-slots-machine",
+ "difficulty":"9.987",
+ "description":[
+ "",
+ "We are now going to try and combine some of the stuff we've just learnt abd create the logic for a slot machine game",
+ "For this we will need to generate three random numbers between 1
and 5
to represent the possible values of each individual slot",
+ "Store the three random numbers in slotOne
, slotTwo
and slotThree
",
+ "Generate the random numbers by using the system we used earlier in /challenges/random-whole-numbers-in-a-range",
+ " Math.floor(Math.random() * (5 - 1 + 1)) + 1;
"
+ ],
+ "tests":[
+ "assert(typeof(runSlots($(''))[0]) == 'number', 'SlotOne should be a random number');",
+ "assert(typeof(runSlots($(''))[1]) == 'number', 'SlotTwo should be a random number');",
+ "assert(typeof(runSlots($(''))[2]) == 'number', 'SlotThree should be a random number');",
+ "assert(editor.getValue().match(/Math.floor\\(Math.random\\(\\) \\* \\(5 \\- 1 \\+ 1\\)\\) \\+ 1/g).length === 3);"
+ ],
+ "challengeSeed":[
+ "fccss",
+ " function runSlots(slots){",
+ " var slotOne;",
+ " var slotTwo;",
+ " var slotThree;",
+ " ",
+ " /*Don't modify above here*/",
+ " ",
+ " ",
+ " ",
+ " /*Don't modify below here*/",
+ " ",
+ " if(slotOne !== undefined && slotTwo !== undefined && slotThree !== undefined){",
+ " $('.logger').html(slotOne + ' ' + slotTwo + ' ' + slotThree);",
+ " }",
+ " return([slotOne, slotTwo, slotThree]);",
+ " }",
+ "",
+ " $(document).ready(function(){",
+ " var slots = $('.slot');",
+ " ",
+ " $('.go').click(function(){",
+ " runSlots(slots);",
+ " });",
+ " });",
+ "fcces",
+ " ",
+ "