Skip to content

Commit

Permalink
added basic javascript object example
Browse files Browse the repository at this point in the history
  • Loading branch information
robynitp committed Feb 26, 2015
1 parent a48e7ee commit b0acd87
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions week5/00-json/00-javascript-object.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
var allColors = {
red: {
title: "Red as in Crimson",
hexcode: "#ff0000"
},
green: {
title: "Green as in Kale",
hexcode: "#00ff00"
},
blue: {
title: "Blue as in Sky",
hexcode: "#0000ff"
},
};

console.log("The object containing all the color objects:");
console.log(allColors);

var color = "red";

var chosenColorObject = allColors[color];

console.log("The object with the property name, " + color + ":");
console.log(chosenColorObject);

0 comments on commit b0acd87

Please sign in to comment.