Passing a string as first arguement in a constructor? HELP!


#1


https://www.codecademy.com/en/courses/spencer-sandbox/5/3?curriculum_id=506324b3a7dffd00020bf661#

Oops, try again.
Make sure that the_hobbit's author is J.R.R. Tolkien by passing it as the first argument to the Book constructor.


// 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. Tolkein");


#2

Hi the name of the author..

"J.R.R. Tolkein"

it should be J.R.R. Tolkien


#3

OMG , i was stuck for a while for a silly spelling mistake..thank you @wizmarco :smiley: