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 Creating a new class

Adding Properties

Can I get some on this objective. I'm supposed to be adding a parameter?

creating_class.js
class Student {
  constructor(gpa, property) {
   this.parameter = gpa;
   this.property = parameter;
  }
}

2 Answers

Jamie Moore
Jamie Moore
3,997 Points

Hey Alonzo,

I think you're nearly there, but you're adding a few things that don't need to be there. You currently have two parameters, gpa and property but there should only be gpa. You then need to declare an attribute gpa, which is equal to the parameter being passed in, like so:

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

Thanks Jamie and my biggest problem with coding is the javascript area, but for you to understand it is great. I'll keep praciting and working towards this challenge.