Created
January 11, 2018 16:18
-
-
Save scriptonian/ecd4a4f4c2f062a4ad889602971b6440 to your computer and use it in GitHub Desktop.
This file contains 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
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); | |
console.log(book); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment