Im currently doing precourse work for web development before I start the full [program and i’ve been stuck on a certain question for a couple days. I don’t want the answer to the question because i’m trying to understand the concept.
This is the question:
// 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.
// Please write all of your code on the lines above.
If anybody can help me better understand this that would be great. I don’t want the answer I want to figure it out on my own. Thanks in advance.