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 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,314 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