update JavaScript challenges

This commit is contained in:
Quincy Larson
2015-08-15 13:57:44 -07:00
parent 5bb658c094
commit 2b6bdd098f
3 changed files with 739 additions and 64 deletions

View File

@ -1,22 +1,23 @@
{ {
"name": "Automated Testing and Debugging - Coming Soon", "name": "Automated Testing and Debugging",
"order": 0.012, "order": 0.012,
"challenges": [ "challenges": [
{ {
"id":"cf1111c1c16feddfaeb6bdef", "id":"cf1111c1c16feddfaeb6bdef",
"title":"Using the Javascript console", "title":"Use the Javascript Console",
"difficulty":0, "difficulty":0,
"description":[ "description":[
"", "Both Chrome and Firefox have excellent JavaScript consoles, also known as DevTools, for debugging your JavaScript.",
"The browser console is the best and easiest tool for debugging your scripts", "You can find <code>Developer tools</code> in your Chrome's menu or <code>Web Console</code> in FireFox's menu. If you're using a different browser, or a mobile phone, we strongly recommend switching to desktop Firefox or Chrome.",
"It can normally be access by pressing f12 in most browsers or right click > inspect element > console", "Let's print to this console using the <code>console.log</code> method.",
"Let's print to this console using the console.log method",
"<code>console.log('Hello world!')</code>" "<code>console.log('Hello world!')</code>"
], ],
"tests":[ "tests":[
"assert(editor.getValue().match(/console\\.log\\(/gi), 'You should use the console.log method to ');" "assert(editor.getValue().match(/console\\.log\\(/gi), 'You should use the console.log method to log \"Hello world!\" to your JavaScript console.');"
], ],
"challengeSeed":[ "challengeSeed":[
"",
"",
"" ""
], ],
"challengeType":1 "challengeType":1
@ -26,22 +27,23 @@
"title":"Using typeof", "title":"Using typeof",
"difficulty":0, "difficulty":0,
"description":[ "description":[
"", "<code>typeof</code> is a useful method that we can use to check the type of a variable.",
"typeof is a useful method that we can use to check the type of a variable", "One thing to be careful of is that an array has the type objects.",
"One thing to be careful of is that an array has the type objects", "Try using each of these to see the types they have.",
"Try using each of these to see the types they have", "<code>console.log(typeof(\"\"));</code>",
"<code>console.log(typeof(\"\"));", "<code>console.log(typeof(0));</code>",
"console.log(typeof(0));", "<code>console.log(typeof([]));</code>",
"console.log(typeof([]));", "<code>console.log(typeof({}));</code>"
"console.log(typeof({}));</code>"
], ],
"tests":[ "tests":[
"assert(editor.getValue().match(/console\\.log\\(typeof\\(\"\"\\)\\);/gi), 'You should console.log the typeof a string');", "assert(editor.getValue().match(/console\\.log\\(typeof\\(\"\"\\)\\);/gi), 'You should <code>console.log</code> the <code>typeof</code> a string.');",
"assert(editor.getValue().match(/console\\.log\\(typeof\\(0\\)\\);/gi), 'You should console.log the typeof a number');", "assert(editor.getValue().match(/console\\.log\\(typeof\\(0\\)\\);/gi), 'You should <code>console.log</code> the <code>typeof</code> a number.');",
"assert(editor.getValue().match(/console\\.log\\(typeof\\(\\[\\]\\)\\);/gi), 'You should console.log the typeof a array');", "assert(editor.getValue().match(/console\\.log\\(typeof\\(\\[\\]\\)\\);/gi), 'You should <code>console.log</code> the <code>typeof</code> an array.');",
"assert(editor.getValue().match(/console\\.log\\(typeof\\(\\{\\}\\)\\);/gi), 'You should console.log the typeof a object');" "assert(editor.getValue().match(/console\\.log\\(typeof\\(\\{\\}\\)\\);/gi), 'You should <code>console.log</code> the <code>typeof</code> a object.');"
], ],
"challengeSeed":[ "challengeSeed":[
"",
"",
"" ""
], ],
"challengeType":1 "challengeType":1

File diff suppressed because it is too large Load Diff

View File

@ -15,7 +15,8 @@
"title":"Waypoint: A Review On Objects", "title":"Waypoint: A Review On Objects",
"difficulty":0, "difficulty":0,
"description":[ "description":[
"Before we dive into Object Oriented Programming Let's take a quick look over objects in javascript" "Before we dive into Object Oriented Programming, let's revisit JavaScript objects.",
"Give your <code>motorBike</code> object the correct attributes."
], ],
"tests":[ "tests":[
"assert(motorBike.wheels===2, 'You should have given motorBike two wheels');", "assert(motorBike.wheels===2, 'You should have given motorBike two wheels');",
@ -47,7 +48,8 @@
"title":"Waypoint: Constructing Objects", "title":"Waypoint: Constructing Objects",
"difficulty":0, "difficulty":0,
"description":[ "description":[
"We are also able to create Objects using functions" "We are also able to create objects using functions.",
""
], ],
"tests":[ "tests":[
"assert((new Car()).wheels === 4, \"myCar.wheels should be four. Make sure that you haven't changed this value\");", "assert((new Car()).wheels === 4, \"myCar.wheels should be four. Make sure that you haven't changed this value\");",
@ -55,12 +57,11 @@
"assert(typeof((new Car()).seats) === 'number', 'myCar.seats should be a number');" "assert(typeof((new Car()).seats) === 'number', 'myCar.seats should be a number');"
], ],
"challengeSeed":[ "challengeSeed":[
"//Let's add the properties engine and seats to the car in the same way that the property wheels has been added below. They should both be numbers", "// Let's add the properties engine and seats to the car in the same way that the property wheels has been added below. They should both be numbers.",
"var Car = function(){", "var Car = function(){",
" this.wheels = 4;", " this.wheels = 4;",
"};", "};",
"", "",
"//Instantiated Here",
"var myCar = new Car();", "var myCar = new Car();",
"", "",
"(function(){return(JSON.stringify(myCar));})();" "(function(){return(JSON.stringify(myCar));})();"