Error message- expected false to be true

function exerciseTwo(userObj){
// Exercise Two: You will be given an object called 'userObj'
// userObject will already have a key on it called 'name'
// Add a method to userObj, called 'greeting'.
// Using the keyword 'this', the greeting method should return the following string:
// 'Hi, my name is ' and the users name.
// eg: If userObj has a name: 'Dan', greeting should return: Hi, my name is Dan'
// NOTE: DO NOT create a new object.
// NOTE: DO NOT create a key called name the key is already on the object.
  greeting:function greeting(){
     return 'Hi, my name is ' +;

  // Please write all of your code on the lines above.
  return userObj;

what is your question?

You haven’t added a method to userObj, what you’ve written isn’t valid syntax. You add methods to objects like

someObj.myMethod = function() {
  /* do something */
1 Like

Thank you DanCouper. It worked!

1 Like