Lesson 32 customizing constructors


#1


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

Edit: I really don't understand why the interface for searching help topics is so unwieldy. I searched this multiple times and found nothing, and then suddenly found posts doing the search what I thought was the exact same way. When I did, finally, it turned out I had been doing it correctly from the beginning, but just distrusted myself and tried something different because I had misspelled "Tolkien." (And I'm an English teacher and fantasy nerd who TEACHES The Hobbit. Sad. Anyway, I wouldn't have wasted anyone's time with this if I had been able to find the Q and A easily the first time. It is that hard to have the Q and A button take you to the area that addresses the lesson you're on?

I can't find any q and a on this exercise, which is weird. In fact, when it lists the topics on Intro to Objects 1, it stops at a certain point and then there aren't any others.

I just have no idea what they want us to do, and nothing to look at for help. Basically, it asks me to do in one line something we've never done in one line.
The only way I can think to do this is to just run together everything the way we've done it without line breaks. I'm pretty sure that's not the goal.


// 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();
the_hobbit.pages = 320;
the_hobbit.author = "J.R.R. Tolkein";


#2

@ehaedgar,
And how many article's do you find doing a google-search
harry_potter site:codecademy.com


#3

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