[Solved] Stuck with the creation of a book object for the_hobbit



function Livre(pages, auteur) {
    this.pages = pages;
    this.auteur = auteur;
var le_hobbit = new Livre(320,"J.R.R. Tolkien");

Oups, merci de réessayer. Avez-vous crée le nouveau avec l'objet Livre ?


Désolé, je ne suis pas couramment la langue française , mais déménagement

avant :


Hi bayoishola20,
I don't think so because the declaration of the constructor must be before the creation of the object itself. Beside this, I follow the file format of this exercice. I try anyway but it doesn't change anything.
I really don't know what is wrong with this declaration.



Okay, the exercise says to do it in three lines. So, you should do something like this:

var harry_potter = new Object();
harry_potter.pages = 350;
harry_potter.auteur = "J.K. Rowling";


This exercise says that we have to use the constructor in one line, beside this I try

var le_hobbit = new Object();
le_hobbit.pages = 320;
le_hobbit.auteur = "J.R.R. Tolkien";

but it's not working too. I really don't how to get throw this. Thank you for taking time with my problem, bayoishola20.



It's 350 not 320. :slight_smile:


No, no it's really 320: :wink:

Pour cet exemple, nous voulons que notre livre ait 320 pages, et que l'auteur soit "J.R.R. Tolkien".
In this sample, we would like to have a book of 320 pages and the author be "J.R.R. Tolkien".

I really write the right solution, I think...



Oooo... My bad! It's 320 really. :mask:


The full stuff now:

var le_hobbit = new Livre();
harry_potter.pages = 320;
harry_potter.auteur = "J.R.R. Tolkien";

function Livre(pages, auteur) {
    this.pages = pages;
    this.auteur = auteur;


I pass throw the corrector :sunny:
I make a copy-paste from the tip and it's working fine. The right solution is:

var le_hobbit = new Livre(320, "J.R.R. Tolkien");

very close to mine...
Thank you bayoishola20.


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