diff --git a/challenges/object-oriented-and-functional-programming.json b/challenges/object-oriented-and-functional-programming.json
index 8f1c7a8a1a..d80a50de85 100644
--- a/challenges/object-oriented-and-functional-programming.json
+++ b/challenges/object-oriented-and-functional-programming.json
@@ -100,7 +100,7 @@
],
"tests":[
"assert(typeof(myBike.getSpeed)!=='undefined' && typeof(myBike.getSpeed) === 'function', 'message: The method getSpeed of myBike should be accessible outside the object.');",
- "assert(typeof(myBike.speed) === 'undefined', 'message: myBike.speed
should remain undefined.');",
+ "assert(typeof(myBike.speed) === 'undefined', 'message: myBike.speed
should be undefined.');",
"assert(typeof(myBike.addUnit) === 'undefined', 'message: myBike.addUnit
should remain undefined.');"
],
"challengeSeed":[
@@ -147,10 +147,11 @@
"A function that creates objects is called a constructor
.",
"You can create instances
of an object using a constructor
.",
"Each new instance
of this object inherits
all the properties
and methods
of your original object.",
- "Then you can give the instance new properties."
+ "Once an instance
has been created you can add properties
to that instance
individually.",
+ "Add an engines
property with a number value to the myCar
instance."
],
"tests":[
- "assert((new Car()).wheels === 4, 'message: The property wheels
should still be 4 like in the object constructor.');",
+ "assert((new Car()).wheels === 4, 'message: The property wheels
should still be 4 in the object constructor.');",
"assert(typeof((new Car()).engines) === 'undefined', 'message: There should not be a property engines
in the object constructor.');",
"assert(myCar.wheels === 4, 'message: The property wheels
of myCar should equal 4.');",
"assert(typeof(myCar.engines) === 'number', 'message: The property engines
of myCar should be a number.');"
@@ -177,12 +178,12 @@
"title":"Iterate over Arrays with .map",
"difficulty":0,
"description":[
+ "The map method is one of the easiest ways to iterate through an array or object there is. Let's use it now.",
"array = array.map(function(val){
",
" return val+1;
",
"});
",
"",
- "The map method is one of the easiest ways to iterate through an array or object there is. Let's use it now.",
- "Use the map function to add 3 to every value in the variable array
"
+ "Use the map function to add 3 to every value in the variable array
."
],
"tests":[
"assert.deepEqual(array, [4,5,6,7,8], 'message: You should add three to each value in the array.');",
@@ -199,6 +200,9 @@
"// Only change code above this line.",
"(function() {return array;})();"
],
+ "MDNlinks":[
+ "Array.map()"
+ ],
"challengeType":1,
"type": "waypoint"
},
@@ -210,10 +214,11 @@
"Reduce can be useful for condensing an array of numbers into one value.",
"var singleVal = array.reduce(function(previousVal, currentVal){
",
" return previousVal+currentVal;
",
- "});
"
+ "});
",
+ "Use the reduce
function to sum all the values in array
and assign it to singleVal
."
],
"tests":[
- "assert(singleVal == 30, 'message: singleVal
should have been set to the result of your reduce operation.');",
+ "assert(singleVal == 30, 'message: singleVal
should be equal to the sum of all items in the array
variable.');",
"assert(editor.getValue().match(/\\.reduce\\s*\\(/gi), 'message: You should have made use of the reduce method.');"
],
"challengeSeed":[
@@ -226,6 +231,9 @@
"// Only change code above this line.",
"(function() {return singleVal;})();"
],
+ "MDNlinks":[
+ "Array.reduce()"
+ ],
"challengeType":1,
"type": "waypoint"
},
@@ -234,7 +242,7 @@
"title":"Filter Arrays with .filter",
"difficulty":0,
"description":[
- "filter is a useful method that can filter out values that don't match a certain criteria",
+ "Filter is a useful method that can filter out values that don't match a certain criteria",
"Let's remove all the values greater than five",
"array = array.filter(function(val) {
",
" return val <= 5;
",
@@ -254,6 +262,9 @@
" // Only change code above this line.",
"(function() {return array;})();"
],
+ "MDNlinks":[
+ "Array.filter()"
+ ],
"challengeType":1,
"type": "waypoint"
},
@@ -262,14 +273,15 @@
"title": "Sort Arrays with .sort",
"difficulty":0,
"description":[
- "You can use the method sort to easily sort the values in the array alphabetically or numerically",
- "var array = [1,3,2];
",
+ "You can use the method sort
to easily sort the values in the array alphabetically or numerically.",
+ "var array = [1, 3, 2];
",
"array = array.sort();
",
- "This will return [1, 2, 3]
"
+ "array
is now [1, 2, 3]
.",
+ "Use sort
to sort array
alphabetically."
],
"tests":[
"assert.deepEqual(array, ['alpha', 'beta', 'charlie'], 'message: You should have sorted the array alphabetically.');",
- "assert(editor.getValue().match(/\\[\\'beta\\'\\,\\s\\'alpha\\'\\,\\s'charlie\\'\\];/gi), 'message: You should be sorting the array using sort.');",
+ "assert(editor.getValue().match(/\\[\\'beta\\'\\,\\s\\'alpha\\'\\,\\s'charlie\\'\\];/gi), 'message: You should only be using .sort
to modify the array.');",
"assert(editor.getValue().match(/\\.sort\\s*\\(\\)/gi), 'message: You should have made use of the sort method.');"
],
"challengeSeed":[
@@ -281,6 +293,9 @@
" // Only change code above this line.",
"(function() {return array;})();"
],
+ "MDNlinks":[
+ "Array.sort()"
+ ],
"challengeType":1,
"type": "waypoint"
},
@@ -288,12 +303,13 @@
"id": "cf1111c1c16feddfaeb2bdef",
"title": "Reverse Arrays with .reverse",
"description": [
- "You can use the .reverse()
function to reverse the contents of an array."
+ "You can use the reverse
function to reverse the contents of an array.",
+ "Add a line of code that uses reverse
to reverse the array
variable."
],
"tests": [
"assert.deepEqual(array, [7,6,5,4,3,2,1], 'message: You should reverse the array.');",
- "assert(editor.getValue().match(/\\.reverse\\s*\\(\\)/gi), 'message: You should use the reverse method.');",
- "assert(editor.getValue().match(/\\[1\\,2\\,3\\,4\\,5\\,6\\,7/gi), 'message: You should return [7,6,5,4,3,2,1]
.');"
+ "assert(editor.getValue().match(/\\.reverse\\s*\\(\\)/gi), 'message: You should use the reverse
method.');",
+ "assert(editor.getValue().match(/\\[1\\,2\\,3\\,4\\,5\\,6\\,7/gi), 'message: You should only be using revserse
to modify array
.');"
],
"challengeSeed": [
"var array = [1,2,3,4,5,6,7];",
@@ -304,6 +320,9 @@
" // Only change code above this line.",
"(function() {return array;})();"
],
+ "MDNlinks":[
+ "Array.reverse()"
+ ],
"challengeType": 1,
"type": "waypoint"
},
@@ -312,12 +331,13 @@
"title": "Concatenate Strings with .concat",
"description": [
".concat()
can be used to merge the contents of two arrays into one.",
- "array = array.concat(otherArray);
"
+ "array = array.concat(otherArray);
",
+ "Use .concat()
to concatenate concatMe
onto the end of array
and assign it back to array."
],
"tests": [
- "assert.deepEqual(array, [1,2,3,4,5,6], 'You should concat the two arrays together.');",
- "assert(editor.getValue().match(/\\.concat\\s*\\(/gi), 'message: You should be use the concat method to merge the two arrays.');",
- "assert(editor.getValue().match(/\\[1\\,2\\,3\\]/gi) && editor.getValue().match(/\\[4\\,5\\,6\\]/gi), 'message: You should only modify the two arrays without changing the origional ones.');"
+ "assert.deepEqual(array, [1,2,3,4,5,6], 'message: You should concat the two arrays together.');",
+ "assert(editor.getValue().match(/\\.concat\\s*\\(/gi), 'message: 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), 'message: You should only be using concat
to modify the arrays.');"
],
"challengeSeed": [
"var array = [1,2,3];",
@@ -330,6 +350,9 @@
"// Only change code above this line.",
"(function() {return array;})();"
],
+ "MDNlinks":[
+ "Array.concat()"
+ ],
"challengeType": 1,
"type": "waypoint"
},
@@ -339,8 +362,9 @@
"difficulty":0,
"description":[
"You can use the .split()
method to split a string into an array.",
- "split uses the argument you give to to split the string.",
- "array = string.split(' ');
"
+ ".split()
uses the argument you pass in as a delimiter to determine which points the string should be split at.",
+ "var array = string.split(' ');
",
+ "Use .split()
to create an array of words from string
and assign it to array
."
],
"tests":[
"assert(typeof(array) === 'object' && array.length === 5, 'message: You should split the string by its spaces.');",
@@ -355,6 +379,9 @@
"// Only change code above this line.",
"(function() {return array;})();"
],
+ "MDNlinks":[
+ "String.split()"
+ ],
"challengeType":1,
"type": "waypoint"
},
@@ -364,10 +391,11 @@
"difficulty":0,
"description":[
"We can use the .join()
method to join each element in an array into a string separated by whatever delimiter you provide as an argument to the join operation.",
- "var joinMe = joinMe.join(\" \");
"
+ "var joinMe = joinMe.join(\" \");
",
+ "Use the .join()
method to create a string from joinMe
with spaces in between each element and assign it back to joinMe
."
],
"tests":[
- "assert(typeof(joinMe) === 'string' && joinMe === \"Split me into an array\", 'message: You should join the arrays by their spaces.');",
+ "assert(typeof(joinMe) === 'string' && joinMe === \"Split me into an array\", 'message: You should join the elements of the array with spaces.');",
"assert(/\\.join\\(/gi, 'message: You should use of the join method on the array.');"
],
"challengeSeed":[
@@ -379,6 +407,9 @@
"// Only change code above this line.",
"(function() {return joinMe;})();"
],
+ "MDNlinks":[
+ "Array.join()"
+ ],
"challengeType":1,
"type": "waypoint"
}