Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save davidystephenson/5912c21c638ad11eb12f6904cf6ab9c2 to your computer and use it in GitHub Desktop.

Select an option

Save davidystephenson/5912c21c638ad11eb12f6904cf6ab9c2 to your computer and use it in GitHub Desktop.
const theHobbit = {
author: 'Tolkien',
protagonist: 'Bilbo',
pages: 300
}
const watchmen = {
author: 'Moore',
protagonist: 'Rorschach',
pages: 450
}
function describeBook (book, key) {
const value = book[key]
console.log('The', key, 'of this book is', value)
}
describeBook(theHobbit, 'author')
describeBook(watchment, 'pages')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment