Quotes help make search much faster. Example: "Practice Makes Perfect"

Wednesday, December 5, 2012

Codecademy: Codeyear The Dot and the Bracket


//sample solution


var australia = {
    weather: "superb",
    people: "not many of them but they're all great!",
    tourism: "a wonderful place to holiday. please visit!"
};

var jordan = new Object();
jordan.weather = "hot. but so are the people!";
jordan.people = "see above!";
jordan.tourism = "Codecademy's dream team retreat!";

// print australia's weather using dot notation
console.log(australia.weather);

// create a new variable "property" and set it to the string "weather"
var property = "weather";

console.log(jordan[property]);

// now modify "property" to be the string "people"
property = "people";

console.log(jordan[property]);

No comments:

Post a Comment


This is an example of scrolling text using Javascript.

Popular Posts