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 Instantiating an object

Brooke Guy
Brooke Guy
8,179 Points

Is my constant wrong?

Is my constant wrong in my answer? I can't figure out what i did wrong...

new_object.js
class Student {
    constructor(gpa){
        this.gpa = gpa;
    }
}
const gpa = new Student ('3.9');

3 Answers

If you read the question again, the challenge asks you to use a specific variable name with a gpa value of 3.9

const student = new Student(3.9)      

Does that answer your question?

Adam Beer
Adam Beer
11,306 Points

Now create a new student variable so var student or const student or let student after this equal to new Student(3.9). When you use numbers don't use apostrophs. Only the strings should be used with apostrophs.

var student = new Student(3.9);

var student = new Student(3.9); it really works