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 trialDane Andrade
13,081 Pointsnot sure how to answer task
class User {
constructor(email, username, birthday) {
this.email = email;
this.username = username;
this.birthday = birthday;
}
changeUsername(username) {
this.username = username;
}
}
user1.changeUsername(“TreehouseStudent2”);
var user1 = new User('JavaScriptStudent@teamtreehouse.com', 'JSUser1', '1/08/1991');
class User {
constructor(email, username, birthday) {
this.email = email;
this.username = username;
this.birthday = birthday;
}
changeUsername(username) {
this.username = username;
}
}
user1.changeUsername(“TreehouseStudent2”);
var user1 = new User('JavaScriptStudent@teamtreehouse.com', 'JSUser1', '1/08/1991');
2 Answers
Peter Vann
36,427 PointsHi Dane!
You've got task 2 above task 1:
This passes task 1:
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');
The curious thing is this should pass task 2:
user1.changeUsername(“TreehouseStudent2”);
But look at the colors!?! It's wrong (but coded correctly)
If I cut and paste from here:
(Steven Parker answer)
Like this:
user1.changeUsername("TreehouseStudent2");
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');
user1.changeUsername("TreehouseStudent2");
That passes!?!
The cut/paste thing is something I'm trying to fix!?!
I hope that helps.
Stay safe and happy coding!
Dane Andrade
13,081 PointsYes the copy and paste definitely threw me off, thank you, I was able to pass it by simply typing it below task 1.