From a60b1debd02d4f23200c5dc13d65fd13c3caeb7a Mon Sep 17 00:00:00 2001 From: MANISH-GIRI Date: Fri, 17 Mar 2017 20:27:15 -0400 Subject: [PATCH] Update challenge to use higher numbers as array elements --- .../basic-javascript.json | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/seed/challenges/02-javascript-algorithms-and-data-structures/basic-javascript.json b/seed/challenges/02-javascript-algorithms-and-data-structures/basic-javascript.json index 90c6339a707..309bbf9c303 100755 --- a/seed/challenges/02-javascript-algorithms-and-data-structures/basic-javascript.json +++ b/seed/challenges/02-javascript-algorithms-and-data-structures/basic-javascript.json @@ -1810,18 +1810,18 @@ "We can access the data inside arrays using indexes.", "Array indexes are written in the same bracket notation that strings use, except that instead of specifying a character, they are specifying an entry in the array. Like strings, arrays use zero-based indexing, so the first element in an array is element 0.", "Example", - "
var array = [1,2,3];
array[0]; // equals 1
var data = array[1]; // equals 2
", + "
var array = [50,60,70];
array[0]; // equals 50
var data = array[1]; // equals 60
", "Note
There shouldn't be any spaces between the array name and the square brackets, like array [0]. Although JavaScript is able to process this correctly, this may confuse other programmers reading your code.", "
", "Create a variable called myData and set it to equal the first value of myArray using bracket notation." ], "challengeSeed": [ "// Example", - "var ourArray = [1,2,3];", - "var ourData = ourArray[0]; // equals 1", + "var ourArray = [50,60,70];", + "var ourData = ourArray[0]; // equals 50", "", "// Setup", - "var myArray = [1,2,3];", + "var myArray = [50,60,70];", "", "// Only change code below this line.", "" @@ -1830,7 +1830,7 @@ "if(typeof myArray !== \"undefined\" && typeof myData !== \"undefined\"){(function(y,z){return 'myArray = ' + JSON.stringify(y) + ', myData = ' + JSON.stringify(z);})(myArray, myData);}" ], "solutions": [ - "var myArray = [1,2,3];\nvar myData = myArray[0];" + "var myArray = [50,60,70];\nvar myData = myArray[0];" ], "tests": [ "assert((function(){if(typeof myArray !== 'undefined' && typeof myData !== 'undefined' && myArray[0] === myData){return true;}else{return false;}})(), 'message: The variable myData should equal the first value of myArray.');", @@ -1860,18 +1860,18 @@ "description": [ "Unlike strings, the entries of arrays are mutable and can be changed freely.", "Example", - "
var ourArray = [3,2,1];
ourArray[0] = 1; // equals [1,2,1]
", + "
var ourArray = [50,40,30];
ourArray[0] = 15; // equals [15,40,30]
", "Note
There shouldn't be any spaces between the array name and the square brackets, like array [0]. Although JavaScript is able to process this correctly, this may confuse other programmers reading your code.", "
", - "Modify the data stored at index 0 of myArray to a value of 3." + "Modify the data stored at index 0 of myArray to a value of 45." ], "challengeSeed": [ "// Example", - "var ourArray = [1,2,3];", - "ourArray[1] = 3; // ourArray now equals [1,3,3].", + "var ourArray = [18,64,99];", + "ourArray[1] = 45; // ourArray now equals [18,45,99].", "", "// Setup", - "var myArray = [1,2,3];", + "var myArray = [18,64,99];", "", "// Only change code below this line.", "", @@ -1881,10 +1881,10 @@ "if(typeof myArray !== \"undefined\"){(function(){return myArray;})();}" ], "solutions": [ - "var myArray = [1,2,3];\nmyArray[0] = 3;" + "var myArray = [18,64,99];\nmyArray[0] = 45;" ], "tests": [ - "assert((function(){if(typeof myArray != 'undefined' && myArray[0] == 3 && myArray[1] == 2 && myArray[2] == 3){return true;}else{return false;}})(), 'message: myArray should now be [3,2,3].');", + "assert((function(){if(typeof myArray != 'undefined' && myArray[0] == 45 && myArray[1] == 64 && myArray[2] == 99){return true;}else{return false;}})(), 'message: myArray should now be [45,64,99].');", "assert((function(){if(code.match(/myArray\\[0\\]\\s*=\\s*/g)){return true;}else{return false;}})(), 'message: You should be using correct index to modify the value in myArray.');" ], "type": "waypoint",