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

Help!!! within this code please;

What is wrong with my code please I wanted to try out the getter function function Ayub(name,lastName){ this.name=name; this.lastName=lastName; get fullName(){ return this.ayub+this.lastName; }

}

var ali=new Ayub("Ayub","Ali"); console.log(ali.fullName);

1 Answer

Your problem seemed to be in the second function. Here is a fixed version of the code you submitted

function Ayub(name,lastName){ 
this.name=name; 
this.lastName=lastName; 
this.fullName=name+" "+lastName;
}
var ali=new Ayub("Ayub","Ali");
console.log(ali.fullName);

Hope it works

Jamin

PS. I think it was because you had an embedded function. the computer ignores the function (and everything in it) unless it is called.