Created
June 6, 2017 16:11
-
-
Save JoeShep/df7f6e25e3786d18c1e034572c22210e to your computer and use it in GitHub Desktop.
Object example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const song = { | |
title: "Private Idaho", | |
artist: "The B-52s", | |
plays: 120, | |
album: "Wild Planet", | |
bandMembers: [ | |
{name:"Fred", roles: {vocals: "lead", instrument: null} } | |
// {"Cindy", | |
// {"Ricky", | |
// {"Keith", | |
// {"Kate"} | |
], | |
makeSongString: function() { | |
return `"${song.title}" is from the album "${song.album}" by ${song.artist}` | |
} | |
} | |
const songCollection = { | |
b52Song: song | |
} | |
console.log("songCollection", songCollection.b52Song ); | |
const member = song.bandMembers[0]; | |
const vocalRole = member.roles.vocals | |
if (vocalRole) { | |
console.log(`${member.name} was the ${vocalRole} singer on this track` ); | |
} else { | |
console.log(`${member.name} did not sing on this track`); | |
} | |
// console.log("Fred's vocals", song.bandMembers[0].roles.vocals); | |
// song["albumCoverColor"] = "red"; | |
// console.log("the artist", song["artist"]); | |
// const record = "album"; | |
// console.log("album?", song[record]); | |
// console.log(song.makeSongString()); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment