Confused on function
rodgerso (0)

Im currently completing a course and would like an answer but please let me write the code. For reference:

// Exercise Three:
// 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'.

So with that my solution:

function sayMyName(myName){
console.log("Hello my name is", myName);
return console.log;
}

let sayPhrase = sayMyName("Josh");

console output: Hello my name is Josh

So i feel like i did this right but im missing something and i can't figure out where i've gone wrong. We have a test checker that spits out: Should return the string 'Hello, my name is ..."
Expected Function to be 'Hello, my name is Josh'.

Can anyone just point me in the right direction where i've gone wrong?

edit: function sayMyName(myName){
let phrase = 'Hello, my name is ' + myName;
return phrase;
}

This is what they were looking for

You are viewing a single comment. View All
mwilki7 (287)

Did you forget the comma inside the string?

rodgerso (0)

@mwilki7 Tried it and unfortunately no, it still gives me the same output.