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 cad378bac5c..4cd3a39a1bb 100644 --- a/seed/challenges/02-javascript-algorithms-and-data-structures/basic-javascript.json +++ b/seed/challenges/02-javascript-algorithms-and-data-structures/basic-javascript.json @@ -1089,8 +1089,8 @@ "In the goodStr above, you can use both quotes safely by using the backslash \\ as an escape character.", "Note
The backslash \\ should not be be confused with the forward slash /. They do not do the same thing.", "
", - "Change the provided string to a string with single quotes at the beginning and end and no escape characters.", - "Right now, the <a> tag in the string uses double quotes everywhere. You will need to change the outer quotes to single quotes so you can remove the escape characters." + "Change the provided string to a string with single quotes at the beginning and end and no escape characters.", + "Right now, the <a> tag in the string uses double quotes everywhere. You will need to change the outer quotes to single quotes so you can remove the escape characters." ], "releasedOn": "January 1, 2016", "challengeSeed": [ @@ -2697,8 +2697,8 @@ ], "type": "waypoint", "challengeType": 1, - "translations": {} - }, + "translations": {} + }, { "id": "56533eb9ac21ba0edf2244c3", "title": "Assignment with a Returned Value", @@ -4229,9 +4229,12 @@ "description": [ "You may have heard the term object before.", "Objects are similar to arrays, except that instead of using indexes to access and modify their data, you access the data in objects through what are called properties.", - "Here's a sample object:", - "
var cat = {
\"name\": \"Whiskers\",
\"legs\": 4,
\"tails\": 1,
\"enemies\": [\"Water\", \"Dogs\"]
};
", "Objects are useful for storing data in a structured way, and can represent real world objects, like a cat.", + "Here's a sample cat object:", + "
var cat = {
\"name\": \"Whiskers\",
\"legs\": 4,
\"tails\": 1,
\"enemies\": [\"Water\", \"Dogs\"]
};
", + "In this example, all the properties are stored as strings, such as - \"name\", \"legs\", and \"tails\". However, you can also use numbers as properties. You can even omit the quotes for single-word string properties, as follows:", + "
var anotherObject = {
make: \"Ford\",
5: \"five\",
\"model\": \"focus\"
};
", + "However, if your object has any non-string properties, JavaScript will automatically typecast them as strings.", "
", "Make an object that represents a dog called myDog which contains the properties \"name\" (a string), \"legs\", \"tails\" and \"friends\".", "You can set these object properties to whatever values you want, as long \"name\" is a string, \"legs\" and \"tails\" are numbers, and \"friends\" is an array." @@ -4348,8 +4351,9 @@ "title": "Accessing Object Properties with Bracket Notation", "description": [ "The second way to access the properties of an object is bracket notation ([]). If the property of the object you are trying to access has a space in its name, you will need to use bracket notation.", + "However, you can still use bracket notation on object properties without spaces.", "Here is a sample of using bracket notation to read an object's property:", - "
var myObj = {
\"Space Name\": \"Kirk\",
\"More Space\": \"Spock\"
};
myObj[\"Space Name\"]; // Kirk
myObj['More Space']; // Spock
", + "
var myObj = {
\"Space Name\": \"Kirk\",
\"More Space\": \"Spock\",
\"NoSpace\": \"USS Enterprise\"
};
myObj[\"Space Name\"]; // Kirk
myObj['More Space']; // Spock
myObj[\"NoSpace\"]; // USS Enterprise
", "Note that property names with spaces in them must be in quotes (single or double).", "
", "Read the values of the properties \"an entree\" and \"the drink\" of testObj using bracket notation and assign them to entreeValue and drinkValue respectively." @@ -4401,11 +4405,11 @@ "id": "56533eb9ac21ba0edf2244c9", "title": "Accessing Object Properties with Variables", "description": [ - "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.", + "Another use of bracket notation on objects is to access a property which is stored as the value of a variable. This can be very useful for iterating through an object's properties or when accessing a lookup table.", "Here is an example of using a variable to access a property:", - "
var someProp = \"propName\";
var myObj = {
propName: \"Some Value\"
};
myObj[someProp]; // \"Some Value\"
", - "Here is one more:", - "
var myDog = \"Hunter\";
var dogs = {
Fido: \"Mutt\",\n Hunter: \"Doberman\",\n Snoopie: \"Beagle\"
};
var breed = dogs[myDog];
console.log(breed);// \"Doberman\"
", + "
var dogs = {
Fido: \"Mutt\",\n Hunter: \"Doberman\",\n Snoopie: \"Beagle\"
};
var myDog = \"Hunter\";
var myBreed = dogs[myDog];
console.log(myBreed); // \"Doberman\"
", + "Another way you can use this concept is when the property's name is collected dynamically during the program execution, as follows:", + "
var someObj = {
propName: \"John\"
};
function propPrefix(str) {
var s = \"prop\";
return s + str;
}
var someProp = propPrefix(\"Name\"); // someProp now holds the value 'propName'
console.log(obj[someProp]); // \"John\"
", "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.", "
", "Use the playerNumber variable to look up player 16 in testObj using bracket notation. Then assign that name to the player variable."