make additional improvements to JavaScript challenge copy

This commit is contained in:
Quincy Larson
2015-08-13 23:44:13 -07:00
parent f3cef6de46
commit 99e7116ee5
2 changed files with 159 additions and 175 deletions

View File

@@ -19,9 +19,9 @@
"Before we dive into Object Oriented Programming Let's take a quick look over objects in javascript"
],
"tests":[
"assert(motorBike.wheels===2, 'You should have given motorBike two wheels');",
"assert(motorBike.engine===1, 'You should have given motorBike one engine');",
"assert(motorBike.seats===1, 'You should have given motorBike one seat');"
"assert(motorBike.wheels===2, 'You should have given motorBike two wheels')",
"assert(motorBike.engine===1, 'You should have given motorBike one engine')",
"assert(motorBike.seats===1, 'You should have given motorBike one seat')"
],
"challengeSeed":[
"//Here is a sample Object",
@@ -53,8 +53,8 @@
],
"tests":[
"assert((new Car()).wheels === 4, \"myCar.wheels should be four. Make sure that you haven't changed this value\");",
"assert(typeof((new Car()).engine) === 'number', 'myCar.engine should be a number');",
"assert(typeof((new Car()).seats) === 'number', 'myCar.seats should be a number');"
"assert(typeof((new Car()).engine) === 'number', 'myCar.engine should be a number')",
"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",
@@ -79,9 +79,9 @@
"We can also create variables and functions that aren't accessible from outside the Object"
],
"tests":[
"assert(typeof(myBike.getSpeed)!=='undefined' && typeof(myBike.getSpeed) === 'function', 'The method getSpeed of myBike should be accessible outside the Object');",
"assert(typeof(myBike.speed) === 'undefined', 'We should not been able');",
"assert(typeof(myBike.addUnit === 'undefined'), '');"
"assert(typeof(myBike.getSpeed)!=='undefined' && typeof(myBike.getSpeed) === 'function', 'The method getSpeed of myBike should be accessible outside the Object')",
"assert(typeof(myBike.speed) === 'undefined', 'We should not been able')",
"assert(typeof(myBike.addUnit === 'undefined'), '')"
],
"challengeSeed":[
"//Let's create an object with a two functions. One attached as a property and one not.",
@@ -127,10 +127,10 @@
"The instance inherits all the properties and methods of the original Object"
],
"tests":[
"assert((new Car()).wheels === 4, 'The property wheels should be four in the object constructor');",
"assert(typeof((new Car()).engine) === 'undefined', 'There should not be a property engine in the object constructor');",
"assert(myCar.wheels === 4, 'The property wheels of myCar should be four');",
"assert(typeof(myCar.engine) === 'number', 'The property engine of myCar should be a number');"
"assert((new Car()).wheels === 4, 'The property wheels should be four in the object constructor')",
"assert(typeof((new Car()).engine) === 'undefined', 'There should not be a property engine in the object constructor')",
"assert(myCar.wheels === 4, 'The property wheels of myCar should be four')",
"assert(typeof(myCar.engine) === 'number', 'The property engine of myCar should be a number')"
],
"challengeSeed":[
"var Car = function(){",
@@ -159,9 +159,9 @@
"The map method is one of the easiest ways to iterate through an array or object there is. Let's use it now"
],
"tests":[
"assert.deepEqual(array, [4,5,6,7,8], 'You should have added three to each value in the array');",
"assert(editor.getValue().match(/\\.map\\(/gi), 'You should be making use of the map method');",
"assert(editor.getValue().match(/\\[1\\,2\\,3\\,4\\,5\\]/gi), 'You should only modify the array with .map');"
"assert.deepEqual(array, [4,5,6,7,8], 'You should have added three to each value in the array')",
"assert(editor.getValue().match(/\\.map\\(/gi), 'You should be making use of the map method')",
"assert(editor.getValue().match(/\\[1\\,2\\,3\\,4\\,5\\]/gi), 'You should only modify the array with .map')"
],
"challengeSeed":[
"//Use map to add three to each value in the array",
@@ -186,8 +186,8 @@
"}</code>"
],
"tests":[
"assert(singleVal == 30, 'singleVal should have been set to the result of you reduce operation');",
"assert(editor.getValue().match(/\\.reduce\\(/gi), 'You should have made use of the reduce method');"
"assert(singleVal == 30, 'singleVal should have been set to the result of you reduce operation')",
"assert(editor.getValue().match(/\\.reduce\\(/gi), 'You should have made use of the reduce method')"
],
"challengeSeed":[
"var array = [4,5,6,7,8];",
@@ -213,8 +213,8 @@
"});</code>"
],
"tests":[
"assert.deepEqual(array, [1,2,3,4,5], 'You should have removed all the values from the array that are less than six');",
"assert(editor.getValue().match(/array\\.filter\\(/gi), 'You should be using the filter method to remove the values from the array');",
"assert.deepEqual(array, [1,2,3,4,5], 'You should have removed all the values from the array that are less than six')",
"assert(editor.getValue().match(/array\\.filter\\(/gi), 'You should be using the filter method to remove the values from the array')",
"assert(editor.getValue().match(/\\[1\\,2\\,3\\,4\\,5\\,6\\,7\\,8\\,9\\,10\\]/gi), 'You should only be using .filter to modify the contents of the array);"
],
"challengeSeed":[
@@ -239,9 +239,9 @@
""
],
"tests":[
"assert.deepEqual(array, ['alpha', 'beta', 'charlie'], 'You should have sorted the array alphabetically');",
"assert(editor.getValue().match(/\\[\\'beta\\'\\,\\s\\'alpha\\'\\,\\s'charlie\\'\\];/gi), 'You should be sorting the array using sort');",
"assert(editor.getValue().match(/\\.sort\\(\\)/gi), 'You should have made use of the sort method');"
"assert.deepEqual(array, ['alpha', 'beta', 'charlie'], 'You should have sorted the array alphabetically')",
"assert(editor.getValue().match(/\\[\\'beta\\'\\,\\s\\'alpha\\'\\,\\s'charlie\\'\\];/gi), 'You should be sorting the array using sort')",
"assert(editor.getValue().match(/\\.sort\\(\\)/gi), 'You should have made use of the sort method')"
],
"challengeSeed":[
"var array = ['beta', 'alpha', 'charlie'];",
@@ -261,9 +261,9 @@
"You can use the reverse method to reverse the contents of an array"
],
"tests": [
"assert.deepEqual(array, [7,6,5,4,3,2,1], 'You should reverse the array');",
"assert(editor.getValue().match(/\\.reverse\\(\\)/gi), '');",
"assert(editor.getValue().match(/\\[1\\,2\\,3\\,4\\,5\\,6\\,7/gi), '');"
"assert.deepEqual(array, [7,6,5,4,3,2,1], 'You should reverse the array')",
"assert(editor.getValue().match(/\\.reverse\\(\\)/gi), '')",
"assert(editor.getValue().match(/\\[1\\,2\\,3\\,4\\,5\\,6\\,7/gi), '')"
],
"challengeSeed": [
"var array = [1,2,3,4,5,6,7];",
@@ -284,9 +284,9 @@
"<code>array = array.concat(otherArray);</code>"
],
"tests": [
"assert.deepEqual(array, [1,2,3,4,5,6], 'You should concat the two arrays together');",
"assert(editor.getValue().match(/\\.concat\\(/gi), 'You should be using the concat method to merge the two arrays');",
"assert(editor.getValue().match(/\\[1\\,2\\,3\\]/gi) && editor.getValue().match(/\\[4\\,5\\,6\\]/gi), 'You should only modify the two arrays without changing the origional ones');"
"assert.deepEqual(array, [1,2,3,4,5,6], 'You should concat the two arrays together')",
"assert(editor.getValue().match(/\\.concat\\(/gi), 'You should be using the concat method to merge the two arrays')",
"assert(editor.getValue().match(/\\[1\\,2\\,3\\]/gi) && editor.getValue().match(/\\[4\\,5\\,6\\]/gi), 'You should only modify the two arrays without changing the origional ones')"
],
"challengeSeed": [
"var array = [1,2,3];",
@@ -310,8 +310,8 @@
"<code>array = string.split(' ');</code>"
],
"tests":[
"assert(typeof(array) === 'object' && array.length === 5, 'You should have split the string by it\\'s spaces');",
"assert(/\\.split\\(/gi, 'You should have made use of the split method on the string');"
"assert(typeof(array) === 'object' && array.length === 5, 'You should have split the string by it\\'s spaces')",
"assert(/\\.split\\(/gi, 'You should have made use of the split method on the string')"
],
"challengeSeed":[
"var string = \"Split me into an array\";",
@@ -332,8 +332,8 @@
"<code>var joinMe = joinMe.join(\" \");</code>"
],
"tests":[
"assert(typeof(joinMe) === 'string' && joinMe === \"Split me into an array\", 'You should have joined the arrays by it\\'s spaces');",
"assert(/\\.join\\(/gi, 'You should have made use of the join method on the array');"
"assert(typeof(joinMe) === 'string' && joinMe === \"Split me into an array\", 'You should have joined the arrays by it\\'s spaces')",
"assert(/\\.join\\(/gi, 'You should have made use of the join method on the array')"
],
"challengeSeed":[
"var joinMe = [\"Split\",\"me\",\"into\",\"an\",\"array\"];",