From b0acd87dfa08665039b9d4b7136406d2a173624d Mon Sep 17 00:00:00 2001 From: Robyn Date: Thu, 26 Feb 2015 17:56:39 -0500 Subject: [PATCH] added basic javascript object example --- week5/00-json/00-javascript-object.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 week5/00-json/00-javascript-object.js diff --git a/week5/00-json/00-javascript-object.js b/week5/00-json/00-javascript-object.js new file mode 100644 index 0000000..7c7b78b --- /dev/null +++ b/week5/00-json/00-javascript-object.js @@ -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); \ No newline at end of file