Fix for access array data with indices

This is a buggy challange (#8843)

Updated description in
seed/challenges/01-front-end-development-certification/html5-and-css.json
to instruct "Create second <p> element after the existing <p> element"

fix for access array data with indices

use deep not-equal in first assertion
This commit is contained in:
Pasayadaan
2016-06-09 21:59:30 -05:00
committed by robjloranger
parent aa8750e140
commit 64dd873008
2 changed files with 4 additions and 3 deletions

View File

@@ -1673,7 +1673,7 @@
"<strong>Example</strong>",
"<blockquote>var array = [1,2,3];<br>array[0]; // equals 1<br>var data = array[1]; // equals 2</blockquote>",
"<h4>Instructions</h4>",
"Create a variable called <code>myData</code> and set it to equal the first value of <code>myArray</code>."
"Create a variable called <code>myData</code> and set it to equal the first value of <code>myArray</code> using bracket notation."
],
"challengeSeed": [
"// Example",
@@ -1693,7 +1693,8 @@
"var myArray = [1,2,3];\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 <code>myData</code> should equal the first value of <code>myArray</code>.');"
"assert((function(){if(typeof myArray !== 'undefined' && typeof myData !== 'undefined' && myArray[0] === myData){return true;}else{return false;}})(), 'message: The variable <code>myData</code> should equal the first value of <code>myArray</code>.');",
"assert((function(){if(code.match(/\\s*=\\s*myArray\\[0\\]/g)){return true;}else{return false;}})(), 'message: The data in variable <code>myArray</code> should be accessed using bracket notation.');"
],
"type": "waypoint",
"challengeType": 1,