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 Object-Oriented JavaScript Working with Classes in JavaScript Adding methods to classes

Help me please

Create an empty method called stringGPA() and add it to the Student class

adding_methods.js
class Student {
    constructor(gpa){
        this.gpa = gpa;
    }
}

const student = new Student(3.9);
Reggie Williams
Reggie Williams
Treehouse Teacher

Hey Hammony Dube similar to the code in the previous video, you will need to add a method to the class. Here the method will be defined just outside of the constructor and named stringGPA

2 Answers

Okay thank you Reggie

Reggie Williams
Reggie Williams
Treehouse Teacher

You're welcome! Were you able to move past this challenge?

yes was able to move past the challange