diff --git a/challenges/01-front-end-development-certification/basic-javascript.json b/challenges/01-front-end-development-certification/basic-javascript.json index 7fdaa78afaf..bc5c642aecf 100644 --- a/challenges/01-front-end-development-certification/basic-javascript.json +++ b/challenges/01-front-end-development-certification/basic-javascript.json @@ -1102,7 +1102,8 @@ "var firstLetterOfLastName = \"\";\nvar lastName = \"Lovelace\";\n\n// Only change code below this line\nfirstLetterOfLastName = lastName[0];" ], "tests": [ - "assert((function(){if(typeof firstLetterOfLastName !== \"undefined\" && code.match(/\\[0\\]/gi) && typeof firstLetterOfLastName === \"string\" && firstLetterOfLastName === \"L\"){return true;}else{return false;}})(), 'message: The firstLetterOfLastName variable should have the value of L.');" + "assert(firstLetterOfLastName === 'L', 'message: The firstLetterOfLastName variable should have the value of L.');", + "assert(code.match(/firstLetterOfLastName\\s*=\\s*lastName\\s*\\[\\s*\\d+\\s*\\]/), 'message: You should use bracket notation.');" ], "type": "waypoint", "challengeType": 1 @@ -1150,7 +1151,7 @@ "You can also use bracket notation to get the character at other positions within a string.", "Remember that computers start counting at 0, so the first character is actually the zeroth character.", "

Instructions

", - "Let's try to set thirdLetterOfLastName to equal the third letter of the lastName variable.", + "Let's try to set thirdLetterOfLastName to equal the third letter of the lastName variable using bracket notation.", "Hint
Try looking at the secondLetterOfFirstName variable declaration if you get stuck." ], "challengeSeed": [ @@ -1173,7 +1174,8 @@ "var lastName = \"Lovelace\";\nvar thirdLetterOfLastName = lastName[2];" ], "tests": [ - "assert(thirdLetterOfLastName === 'v', 'message: The thirdLetterOfLastName variable should have the value of v.');" + "assert(thirdLetterOfLastName === 'v', 'message: The thirdLetterOfLastName variable should have the value of v.');", + "assert(code.match(/thirdLetterOfLastName\\s*=\\s*lastName\\s*\\[\\s*\\d+\\s*\\]/), 'message: You should use bracket notation.');" ], "type": "waypoint", "challengeType": 1 @@ -3886,9 +3888,10 @@ "var myArr = [ 2, 3, 4, 5, 6];\nvar total = 0;\n\nfor (var i = 0; i < myArr.length; i++) {\n total += myArr[i];\n}" ], "tests": [ - "assert(total !== 'undefined', 'message: total should be defined');", + "assert(code.match(/var\\s*total\\s*=\\s*0\\s*;/), 'message: total should be declared and initialized to 0');", "assert(total === 20, 'message: total should equal 20');", - "assert(!/20/.test(code), 'message: Do not set total to 20 directly');" + "assert(code.match(/for\\s*\\((.*?)myArr\\.length/), 'message: You should use a for loop to iterate through myArr.');", + "assert(!code.match(/total[\\s\\+\\-]*=\\s*(\\d(?!\\s*;)|[1-9])/g), 'message: Do not set total to 20 directly');" ], "type": "waypoint", "challengeType": 1