JS Assignment 12: Methods, Loops and the 'this' keyword
h
HannahB593 (2)

I understand and got correct the first exercise but am confused about exercise two... this is what I have:

function exerciseTwo(userObj){
userObj.greeting = function(){
return 'Hi, my name is' + this.name;
};
return userObj;
}

I keep getting the error: "Should add greeting method to userObject object."

You are viewing a single comment. View All
chines22 (0)

@HannahB593 you need to do like this ‘Hi, my name is ‘ and take out line 29 that worked for me