Ask coding questions

← Back to all posts
JS Assignment 12: Methods, Loops and the 'this' keyword
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' +;
return userObj;

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

Vandesm14 (2403)

Can you send me the full assignment as a repl? (copy+paste into a new repl)

HannahB593 (2)

This is the original assignment. @Vandesm14

Vandesm14 (2403)

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

chines22 (0)

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