diff --git a/challenges/01-front-end-development-certification/basic-javascript.json b/challenges/01-front-end-development-certification/basic-javascript.json index a3ab766538..88908cc999 100644 --- a/challenges/01-front-end-development-certification/basic-javascript.json +++ b/challenges/01-front-end-development-certification/basic-javascript.json @@ -3221,6 +3221,8 @@ "Another use of bracket notation on objects is to use a variable to access a property. This can be very useful for iterating through lists of the object properties or for doing the lookup.", "Here is an example of using a variable to access a property:", "
var someProp = \"propName\";", + "Here is one more:", + "
var myObj = {
propName: \"Some Value\"
}
myObj[someProp]; // \"Some Value\"
var myDog = \"Hunter\";", "Note that we do not use quotes around the variable name when using it to access the property because we are using the value of the variable, not the name", "
var dogs = {
Fido: \"Mutt\",\n Hunter: \"Doberman\",\n Snoopie: \"Beagle\"
}
var breed = dogs[myDog]; // \"Hunter\"
console.log(breed)// \"Doberman\"
playerNumber
variable to lookup player 16
in testObj
using bracket notation."
@@ -3240,7 +3242,7 @@
"var player = testObj; // Change this Line"
],
"tail": [
- ""
+ "if(typeof player !== \"undefined\"){(function(v){return v;})(player);}"
],
"solutions": [
"var testObj = {\n 12: \"Namath\",\n 16: \"Montana\",\n 19: \"Unitas\"\n};\nvar playerNumber = 16;\nvar player = testObj[playerNumber];"