update JavaScript challenges

pull/1789/head
Quincy Larson 2015-08-15 13:57:44 -07:00
parent 1dd0294a18
commit f2ee2e4031
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,
"challenges": [
{
"id":"cf1111c1c16feddfaeb6bdef",
"title":"Using the Javascript console",
"title":"Use the Javascript Console",
"difficulty":0,
"description":[
"",
"The browser console is the best and easiest tool for debugging your scripts",
"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 console.log method",
"Both Chrome and Firefox have excellent JavaScript consoles, also known as DevTools, for debugging your JavaScript.",
"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.",
"Let's print to this console using the <code>console.log</code> method.",
"<code>console.log('Hello world!')</code>"
],
"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":[
"",
"",
""
],
"challengeType":1
@ -26,22 +27,23 @@
"title":"Using typeof",
"difficulty":0,
"description":[
"",
"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",
"Try using each of these to see the types they have",
"<code>console.log(typeof(\"\"));",
"console.log(typeof(0));",
"console.log(typeof([]));",
"console.log(typeof({}));</code>"
"<code>typeof</code> 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.",
"Try using each of these to see the types they have.",
"<code>console.log(typeof(\"\"));</code>",
"<code>console.log(typeof(0));</code>",
"<code>console.log(typeof([]));</code>",
"<code>console.log(typeof({}));</code>"
],
"tests":[
"assert(editor.getValue().match(/console\\.log\\(typeof\\(\"\"\\)\\);/gi), 'You should console.log the typeof 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\\(\\[\\]\\)\\);/gi), 'You should console.log the typeof a 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 string.');",
"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 <code>console.log</code> the <code>typeof</code> an array.');",
"assert(editor.getValue().match(/console\\.log\\(typeof\\(\\{\\}\\)\\);/gi), 'You should <code>console.log</code> the <code>typeof</code> a object.');"
],
"challengeSeed":[
"",
"",
""
],
"challengeType":1

File diff suppressed because it is too large Load Diff

View File

@ -15,7 +15,8 @@
"title":"Waypoint: A Review On Objects",
"difficulty":0,
"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":[
"assert(motorBike.wheels===2, 'You should have given motorBike two wheels');",
@ -47,7 +48,8 @@
"title":"Waypoint: Constructing Objects",
"difficulty":0,
"description":[
"We are also able to create Objects using functions"
"We are also able to create objects using functions.",
""
],
"tests":[
"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');"
],
"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(){",
" this.wheels = 4;",
"};",
"",
"//Instantiated Here",
"var myCar = new Car();",
"",
"(function(){return(JSON.stringify(myCar));})();"