// Create a function called 'sayMyName'. It will take one parameter. Call this
// parameter 'myName'. Return the phrase "Hello, my name is " and the myName parameter.
// eg: if name is 'Dan' it should return the string: 'Hello, my name is Dan'.
You're on the right track, but you're defining
myName twice by including it as a parameter to
sayMyName() and then explicitly declaring it with
let myName = 'William';. You can remove the
let declaration and pass in the value that you'd like for
myName when you invoke the function:
There are two things going on in your code sample: function declaration (where you use the
function keyword, give your function a name, define its parameters, and define what it does), and function invocation (where you invoke your function and pass in the name that you want it to respond with).
In your function declaration, you should use
myName as a parameter name, since that's what your exercise asks for. The function return value should include
myName, since otherwise your function doesn't know that you want it to use the name:
return 'Hello, my name is' + myName;
If you're confused by this line, look up string concatenation.
After you've declared your function, you can use it by referring to its name,
sayMyName(). If you don't put anything in the parentheses, you're not passing anything to the
myName parameter. If you put a string in the parentheses -
'William', for example - that string will take the place of
myName inside of your function declaration.