Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript Practice Classes in JavaScript Practicing Classes Practice Adding Methods

The first challenge was easier: class User { constructor(email, username, birthday) { this.e

but I just to get the second question. Can someone please help?

User.js
class User {
    constructor(email, username, birthday) {
        this.email = email;
        this.username = username;
        this.birthday = birthday;
    }

    changeUsername(username) {
        this.username = username;
    }
}

var user1 = new User('JavaScriptStudent@teamtreehouse.com', 'JSUser1', '1/08/1991');

1 Answer

Steven Parker
Steven Parker
230,995 Points

Task 2 is just calling the method you created in task 1. So create a new line at the bottom, and using the "user1" object that the code has already created, call your method and pass it the string the instructions tell you to use.

Isn't that easier than task 1?

I will try this tomorrow, I am getting very tired ... and when I get up this afternoon, I hope I will understand it, because, just looking through google, until it finds it ... then I have nothing understood, this is why I want to repeat anything on treehouse again one more time, at the beginning, you just want to have points as many as possible, but than you start thinking ... hey, it's not the points, I want to know all those things, I did it like this with ruby and it worked well, so I think, if I lean for another 6 months, without getting any more points, but then I hope a am good at it. This is why your hints are always very gut Steve because they make you think about the problem and not just copy/paste the solution in ... thank you very much, Steven, I think today, I just hope that tomorrow I think all of a sudden ... oh gosh, how stupid was that of me ... thank you, Steve, kind regards Jan,