getify / You-Dont-Know-JS

A book series on JavaScript. @YDKJS on twitter.
Other
178.98k stars 33.46k forks source link

YDKJS get-started Ch. 2 for 2nd Edition (miss-wording?) #1543

Closed Vincent5182 closed 4 years ago

Vincent5182 commented 4 years ago

should bookDetails.publishedOn be bookDetails.pubDate?

class Book extends Publication {
    constructor(bookDetails) {
        super(
            bookDetails.title,
            bookDetails.author,
            bookDetails.publishedOn
        );
        this.publisher = bookDetails.publisher;
        this.ISBN = bookDetails.ISBN;
    }

    print() {
        super.print();
        console.log(`
            Published By: ${this.publisher}
            ISBN: ${this.ISBN}
        `);
    }
}

class BlogPost extends Publication {
    constructor(title,author,pubDate,URL) {
        super(title,author,pubDate);
        this.URL = URL;
    }

    print() {
        super.print();
        console.log(this.URL);
    }
}
Vincent5182 commented 4 years ago

looks like this was meant to be publishedOn

getify commented 4 years ago

I think I was trying to show that the names don't have to be the same, since you're passing them manually as arguments.