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 trialPrakash Shrestha
Courses Plus Student 2,134 PointsI am having difficulty on adding method in classs
I dont know what is wrong on code
class Student {
constructor(gpa){
this.gpa = gpa;
this.stringGPA = stringGPA;
}
}
stringGPA()
{
console.log(this.stringGPA);
}
const student = new Student(3.9);
1 Answer
Steven Parker
231,268 PointsThere seems to be three issues:
- the method needs to be placed inside the class definition (before the final brace)
- the method should "convert the value of the gpa property to a string ,,,"
- the method should return the converted value (not log it)