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 trialFelex Chivave
7,288 Pointshelp i cant create the needed infor here
i am stuck
class Student {
constructor($gpa){
$gpa = gpa;
}
}
1 Answer
John Lack-Wilson
8,181 PointsYou're nearly there - I would remove the $ sign though and leave the parameter as gpa because the challenge may not pass if there is a $ sign before gpa.
Secondly the challenge is asking you to give the Student class a field called gpa. We can do this using the this keyword.
Here's an example:
class Teacher {
constructor(name) {
this.name = name;
}
}
The above code would assign the name passed to the constructor as the Teacher's name.