Ready JavaScript Curriculum

pull/1259/merge
benmcmahon100 2015-07-30 23:46:47 +01:00
parent d588263658
commit b9adf97a91
1 changed files with 221 additions and 70 deletions

View File

@ -121,7 +121,7 @@
"For example, if we created a variable <code>var firstName = \"Julie\"</code>, we could find out how long the string \"Julie\" is by using the <code>firstName.length</code> property."
],
"tests": [
"(function(){if(typeof(lastNameLength) != 'undefined' && typeof(lastNameLength) == 'number' && lastNameLength == 4){return(true);}else}{return(false);}}, 'lastNameLength should be equal to four')()"
"(function(){if(typeof(lastNameLength) != 'undefined' && typeof(lastNameLength) == 'number' && lastNameLength == 4){return(true);}else{return(false);}})(), 'lastNameLength should be equal to four')()"
],
"challengeSeed": [
"var firstName = \"Madeline\";",
@ -1096,6 +1096,8 @@
" 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'];",
" ",
" /*Don't modify above here*/",
" ",
" ",
@ -1145,75 +1147,224 @@
" </div>",
" </div>",
"</div>",
"",
"<link href='http://fonts.googleapis.com/css?family=Lobster' rel='stylesheet' type='text/css'>",
"",
"<style>",
" .container {",
" background-color: darkred;",
" height: 400px;",
" width: 260px;",
" margin: 50px auto;",
" border-radius: 4px;",
" }",
" .header {",
" border: 2px solid gold;",
" border-radius: 4px;",
" height: 50px;",
" margin: 14px auto;",
" }",
" .header h2 {",
" font-size: 24px;",
" margin: 10px 30px;",
" padding: 0;",
" font-family: lobster;",
" color: gold;",
" }",
" .slots{",
" display: flex;",
" background-color: rgb(90, 1, 1);",
" border-radius: 6px;",
" }",
" .slot{",
" flex: 1 0 auto;",
" background: white;",
" height: 75px;",
" margin: 8px;",
" border: 2px solid brown;",
" border-radius: 4px;",
" }",
" .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);",
" }",
"</style>"
],
"",
"<link href='http://fonts.googleapis.com/css?family=Lobster' rel='stylesheet' type='text/css'>",
"",
"<style>",
" .container {",
" background-color: darkred;",
" height: 400px;",
" width: 260px;",
" margin: 50px auto;",
" border-radius: 4px;",
" }",
" .header {",
" border: 2px solid gold;",
" border-radius: 4px;",
" height: 50px;",
" margin: 14px auto;",
" }",
" .header h2 {",
" font-size: 24px;",
" margin: 10px 30px;",
" padding: 0;",
" font-family: lobster;",
" color: gold;",
" }",
" .slots{",
" display: flex;",
" background-color: rgb(90, 1, 1);",
" border-radius: 6px;",
" }",
" .slot{",
" flex: 1 0 auto;",
" background: white;",
" height: 75px;",
" margin: 8px;",
" border: 2px solid brown;",
" border-radius: 4px;",
" }",
" .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);",
" }",
"</style>"
],
"challengeType": 0
},
{
"id":"cf1111c1c13feddfaeb1bdef",
"name":"Setting Up The Slot Machine Slots",
"dashedName":"setting-up-the-slot-machine-slots",
"difficulty":"9.987",
"description":[
"",
"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",
"du"
],
"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;",
" ",
" 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;",
" ",
" /*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",
" ",
"<div>",
" <div class = 'container inset'>",
" <div class = 'header inset'>",
" <h2>FCC Slot Machine</h2>",
" </div>",
" <div class = 'slots inset'>",
" <div class = 'slot inset'>",
" ",
" </div>",
" <div class = 'slot inset'>",
" ",
" </div>",
" <div class = 'slot inset'>",
" ",
" </div>",
" </div>",
" <br/>",
" <div class = 'outset'>",
" <button class = 'go inset'>",
" Go",
" </button>",
" </div>",
" <br/>",
" <div class = 'foot inset'>",
" <span class = 'logger'></span>",
" </div>",
" </div>",
"</div>",
"",
"<link href='http://fonts.googleapis.com/css?family=Lobster' rel='stylesheet' type='text/css'>",
"",
"<style>",
" .container {",
" background-color: darkred;",
" height: 400px;",
" width: 260px;",
" margin: 50px auto;",
" border-radius: 4px;",
" }",
" .header {",
" border: 2px solid gold;",
" border-radius: 4px;",
" height: 50px;",
" margin: 14px auto;",
" }",
" .header h2 {",
" font-size: 24px;",
" margin: 10px 30px;",
" padding: 0;",
" font-family: lobster;",
" color: gold;",
" }",
" .slots{",
" display: flex;",
" background-color: rgb(90, 1, 1);",
" border-radius: 6px;",
" }",
" .slot{",
" flex: 1 0 auto;",
" background: white;",
" height: 75px;",
" margin: 8px;",
" border: 2px solid brown;",
" border-radius: 4px;",
" }",
" .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);",
" }",
"</style>"
],
"challengeType": 0
}
]