From d06df1ee58d496f7135bee5794517e7aab3d9ad8 Mon Sep 17 00:00:00 2001 From: Pranay Berry Date: Fri, 13 May 2016 00:11:28 +0530 Subject: [PATCH] Added a test case and updated instructions. Added one more test case to check for use of only one element of the array and changed the existing test case for better flexibility. Updated instructions for better understanding of the challenge. --- .../basic-javascript.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/challenges/01-front-end-development-certification/basic-javascript.json b/challenges/01-front-end-development-certification/basic-javascript.json index 579fd5c4c9..b8327023d1 100644 --- a/challenges/01-front-end-development-certification/basic-javascript.json +++ b/challenges/01-front-end-development-certification/basic-javascript.json @@ -1759,7 +1759,7 @@ "Example", "
var arr = [
[1,2,3],
[4,5,6],
[7,8,9],
[[10,11,12], 13, 14]
];
arr[0]; // equals [1,2,3]
arr[1][2]; // equals 6
arr[3][0][1]; // equals 11
", "

Instructions

", - "Read from myArray using bracket notation so that myData is equal to 8" + "Using bracket notation select an element from myArray such that myData is equal to 8." ], "releasedOn": "January 1, 2016", "challengeSeed": [ @@ -1778,7 +1778,8 @@ ], "tests": [ "assert(myData === 8, 'message: myData should be equal to 8.');", - "assert(/myArray\\[2\\]\\[1\\]/g.test(code), 'message: You should be using bracket notation to read the value from myArray.');" + "assert(/myArray\\[\\d+\\]\\[\\d+\\]/g.test(code), 'message: You should be using bracket notation to read the value from myArray.');", + "assert(/myData\\s*?=\\s*?myArray\\[\\d+\\]\\[\\d+\\]\\s*?;/g.test(code), 'message: You should only be reading one value from myArray.');" ], "type": "waypoint", "challengeType": 1,