I thought I made the method already, how was I suppose to do it.
greeting: function()
will be a method. Then you need to tell the function what to do, given the lesson’s instructions.
ok I did as much I could but I still got this and it still doesn’t work…
function exerciseTwo(userObj){
greeting: function(Dan){
return ‘Hi, my name is’+ this.name;
}
return userObj;
}
Your function doesn’t need to call an argument.
Also, the example I provided is an object method - it’s not how to set a method.
what about this then?
userObj.greeting = function () {
return 'Hi, my name is ’ + this.name;
}
There you go! That should do the trick.
1 Like