diff --git a/challenges/basic-javascript.json b/challenges/basic-javascript.json index daf3b02e8e..c1addc033d 100644 --- a/challenges/basic-javascript.json +++ b/challenges/basic-javascript.json @@ -1111,8 +1111,6 @@ " }", "", " $(document).ready(function(){", - " var slots = $('.slot');", - " ", " $('.go').click(function(){", " runSlots(slots);", " });", @@ -1228,14 +1226,10 @@ "Now that we have our random numbers we need to go and check for when they are all the same that means we should count it as a win", "Different numbers will have different values so we need to return the matched number or null", "If we get a match we should change the value of win to the number that we have three of or leave it as null", - "", - "This Is Not Done Yet" + "Let's create an if statement with multiple conditions to check that all the numbers are equal" ], "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);" + "assert((function(){var data = runSlots();if(data == null){return(true)}else{if(data[0] == data[1] && data[1] == data[2]){return(true);}else{return(false);}}})(), 'If all three of our random numbers are the same we should return that number. Otherwise we should return null');" ], "challengeSeed":[ "fccss", @@ -1246,12 +1240,12 @@ " ", " var images = ['http://bit.ly/fcc-kittens','http://bit.ly/fcc-kittens','http://bit.ly/fcc-kittens','http://bit.ly/fcc-kittens','http://bit.ly/fcc-kittens'];", " ", - " var win = null;", - " ", " slotOne = Math.floor(Math.random() * (5 - 1 + 1)) + 1;", " slotTwo = Math.floor(Math.random() * (5 - 1 + 1)) + 1;", " slotThree = Math.floor(Math.random() * (5 - 1 + 1)) + 1;", " ", + " $('.logger').html('');", + " ", " /*Don't modify above here*/", " ", " ", @@ -1259,14 +1253,14 @@ " /*Don't modify below here*/", " ", " if(slotOne !== undefined && slotTwo !== undefined && slotThree !== undefined){", - " $('.logger').html(win);", + " $('.logger').html(slotOne);", + " $('.logger').append(' ' + slotTwo);", + " $('.logger').append(' ' + slotThree);", " }", " return([slotOne, slotTwo, slotThree]);", " }", "", " $(document).ready(function(){", - " var slots = $('.slot');", - " ", " $('.go').click(function(){", " runSlots(slots);", " });", @@ -1337,6 +1331,166 @@ " margin: 8px;", " border: 2px solid brown;", " border-radius: 4px;", + " text-align: center;", + " padding-top: 25px;", + " }", + " .go {", + " width: 100%;", + " color: gold;", + " background-color: rgb(90, 1, 1);", + " border: 2px solid gold;", + " border-radius: 2px;", + " box-sizing: none;", + " outline: none!important;", + " }", + " .foot {", + " height: 150px;", + " background-color: rgb(90,1,1);", + " }", + " ", + " .logger {", + " color: white;", + " margin: 10px;", + " }", + " ", + " .outset {", + " -webkit-box-shadow: 0px 0px 15px -2px rgba(0,0,0,0.75);", + " -moz-box-shadow: 0px 0px 15px -2px rgba(0,0,0,0.75);", + " box-shadow: 0px 0px 15px -2px rgba(0,0,0,0.75);", + " }", + " ", + " .inset {", + " -webkit-box-shadow: inset 0px 0px 15px -2px rgba(0,0,0,0.75);", + " -moz-box-shadow: inset 0px 0px 15px -2px rgba(0,0,0,0.75);", + " box-shadow: inset 0px 0px 15px -2px rgba(0,0,0,0.75);", + " }", + "" + ], + "challengeType": 0 + }, + { + "id":"cf1111c1c13feddfaeb2bdef", + "name":"Giving The Slot Machine Life", + "dashedName":"giving-the-slot-machine-life", + "difficulty":"9.987", + "description":[ + "", + "Now we can detect a win let's get the slot machine to look like it works", + "We're going to 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 one like this", + "$($('.slot')[0])", + "This will grab the the first slot so that we can add the numbers we generate to them", + "Use the above selector to display each number in the corresponding slot" + ], + "tests":[ + "assert((function(){if($($('.slot')[0]).html() !== '' && $($('.slot')[1]).html() !== '' $($('.slot')[2]).html() !== ''){return(true);}else{return(false);}})(), '');" + ], + "challengeSeed":[ + "fccss", + " function runSlots(slots){", + " var slotOne;", + " var slotTwo;", + " var slotThree;", + " ", + " var images = ['http://bit.ly/fcc-kittens','http://bit.ly/fcc-kittens','http://bit.ly/fcc-kittens','http://bit.ly/fcc-kittens','http://bit.ly/fcc-kittens'];", + " ", + " slotOne = Math.floor(Math.random() * (5 - 1 + 1)) + 1;", + " slotTwo = Math.floor(Math.random() * (5 - 1 + 1)) + 1;", + " slotThree = Math.floor(Math.random() * (5 - 1 + 1)) + 1;", + " ", + " $('.logger').html('');", + " ", + " if(slotOne != slotTwo || slotTwo != slotThree){", + " return(null);", + " }", + " ", + " /*Don't modify above here*/", + " ", + " ", + " ", + " /*Don't modify below here*/", + " ", + " if(slotOne !== undefined && slotTwo !== undefined && slotThree !== undefined){", + " $('.logger').html(slotOne);", + " $('.logger').append(' ' + slotTwo);", + " $('.logger').append(' ' + slotThree);", + " }", + " return([slotOne, slotTwo, slotThree]);", + " }", + "", + " $(document).ready(function(){", + " $('.go').click(function(){", + " runSlots(slots);", + " });", + " });", + "fcces", + " ", + "
", + "
", + "
", + "

FCC Slot Machine

", + "
", + "
", + "
", + " ", + "
", + "
", + " ", + "
", + "
", + " ", + "
", + "
", + "
", + "
", + " ", + "
", + "
", + "
", + " ", + "
", + "
", + "
", + "", + "", + "", + "