Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

JavaScript Object-Oriented JavaScript Working with Classes in JavaScript Adding methods to classes


I Need a little Assistance with this one.

class Student {
    constructor(gpa, stringGPA){
        this.gpa = gpa;
        this.stringGPA = stringGPA;
  stringGPA (){
    return toString(this.gpa);


const student = new Student(3.9);

2 Answers

Steven Parker
Steven Parker
217,533 Points

You're close, but "toString" is not a function. It's a method you would call using dot notation:

    return this.gpa.toString();
Jamie Carter
Jamie Carter
Front End Web Development Techdegree Student 10,754 Points

And following on from Steven, that expression is Object Oriented Javascript.

Object.toString() is just what you are building for Student.stringGPA()

Lots of base things like arrays and objects have these kinds of properties. It blew my mind when I realised this.

another example is Array.length

Thank you very much, got it! Was a little bit off but its sorted now thank you.