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 Introducing ES2015 Classes Getter and Setter Methods

shirshah sahel
shirshah sahel
10,035 Points

Can some please take a look at what I might be missing in my code.

'use strict';

class Student {

  get name(){
  return `${this.firstName} ${this.lastName}`;
  }


  constructor({ firstName, lastName, age, interestLevel = 5 } = {}) {
    this.firstName= firstName;
    this.lastName= lastName;
    this.age = age;
    this.interestLevel = interestLevel;
  }
}

let stevenJ= new Student({firstName: 'steven';, lastName:'Jones', age: 22});
console.log(stevenJ.name);    

3 Answers

Steven Parker
Steven Parker
231,124 Points

On the 2nd to last line, there's a stray extra semicolon between the name 'steven' and the comma.

ah... Eagle eyes.

Steven Parker has the Eyes of an Eagle

shirshah sahel
shirshah sahel
10,035 Points

Thank you Steven, got it.