Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
var book = {
tarzan : { publisher: "Pub A", author: "Author A", pageCount: 300},
cinderella : { publisher: "Pub B", author: "Author B", pageCount: 400},
"hidden universe" : { publisher: "Pub C", author: "Konstantin", pageCount: 1000},
addBook : function(name, publisher, author, pageCount) {
this[name] = {publisher: publisher, author:author, pageCount};
book.addBook('JS Objects', "Publisher Z", "Konstantin", 300);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment