32. Customizing Constructors - incorrect error message


#1


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


If you misspell J.R.R. Tolkien's name as your author in the new Book constructor the error message will read: "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."

That is incorrect. The first argument in the custom constructor function for Book is pages, not author. The author's name should be passed as the SECOND argument to the Book constructor. Check the spelling and try again.


// 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

You misspelled "Tolkein"

Its "Tolkien" and not "Tolkein"


#3

Same issue. Error message should indicate that the name should be input as the second argument.


#4

I have the same issue again! Was anyone able to fix the problem?


#5

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.