Skip to content

Instantly share code, notes, and snippets.

@codecademydev
Created July 8, 2016 02:09
Show Gist options
  • Save codecademydev/95b30c2f3e9ce25e424ea172b5d7a975 to your computer and use it in GitHub Desktop.
Save codecademydev/95b30c2f3e9ce25e424ea172b5d7a975 to your computer and use it in GitHub Desktop.
Codecademy export
// 3 lines required to make harry_potter
var harry_potter = new Object();
harry_potter.pages = 350;
harry_potter.author = "J.K. Rowling";
// A custom constructor for book
function Book (pages, author) {
this.pages = pages;
this.author = author;
}
// Use our new constructor to make the_hobbit in one line
var the_hobbit = new Book(320, "J.R.R. Tolkien" );
console.log(the_hobbit);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment