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

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
Vandesm14 (692)

@HannahB593 I'm not sure what's wrong with your code. Are you able to contact your teacher about this issue?