diff --git a/seed/challenges/01-front-end-development-certification/object-oriented-and-functional-programming.json b/seed/challenges/01-front-end-development-certification/object-oriented-and-functional-programming.json index 68cf3b7c23..db77cbba8a 100644 --- a/seed/challenges/01-front-end-development-certification/object-oriented-and-functional-programming.json +++ b/seed/challenges/01-front-end-development-certification/object-oriented-and-functional-programming.json @@ -306,22 +306,22 @@ "The map method is a convenient way to iterate through arrays. Here's an example usage:", "
var timesFour = oldArray.map(function(val){
  return val * 4;
});
", "", - "The map method will iterate through every element of the array, creating a new array with values that have been modified by the callback function, and return it.", + "The map method will iterate through every element of the array, creating a new array with values that have been modified by the callback function, and return it. Note that it does not modify the original array.", "In our example the callback only uses the value of the array element (the val argument) but your callback can also include arguments for the index and array being acted on.", - "Use the map function to add 3 to every value in the variable oldArray." + "Use the map function to add 3 to every value in the variable oldArray, and save the results into variable newArray. oldArray should not change." ], "challengeSeed": [ "var oldArray = [1,2,3,4,5];", - "var newArray = [];", "", "// Only change code below this line.", "", - "newArray = oldArray;" + "var newArray = oldArray;" ], "tail": [ "(function() {return newArray;})();" ], "tests": [ + "assert.deepEqual(oldArray, [1,2,3,4,5], 'message: You should not change the original array.');", "assert.deepEqual(newArray, [4,5,6,7,8], 'message: You should add three to each value in the array.');", "assert(editor.getValue().match(/\\.map\\s*\\(/gi), 'message: You should be making use of the map method.');", "assert(editor.getValue().match(/\\[1\\,2\\,3\\,4\\,5\\]/gi), 'message: You should only modify the array with map.');" @@ -390,21 +390,21 @@ "The following code is an example of using filter to remove array elements that are equal to five:", "Note: We omit the second and third arguments since we only need the value", "
array = array.filter(function(val) {
  return val !== 5;
});
", - "Use filter to remove all elements from oldArray that are greater than 5." + "Use filter to filter out all elements from oldArray that are greater than 5 and store the results into newArray. oldArray should not change." ], "challengeSeed": [ "var oldArray = [1,2,3,4,5,6,7,8,9,10];", - "var newArray = [];", "", "// Only change code below this line.", "", - "newArray = oldArray;" + "var newArray = oldArray;" ], "tail": [ "(function() {return newArray;})();" ], "tests": [ - "assert.deepEqual(newArray, [1,2,3,4,5], 'message: You should have removed all the values from the array that are greater than 5.');", + "assert.deepEqual(oldArray, [1,2,3,4,5,6,7,8,9,10], 'message: You should not change the original array.');", + "assert.deepEqual(newArray, [1,2,3,4,5], 'message: You should have filtered out all values from the array that are greater than 5.');", "assert(editor.getValue().match(/array\\.filter\\s*\\(/gi), 'message: 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), 'message: You should only be using filter to modify the contents of the array.');" ],