Help me in this, i didn't understand how you say it!


#1


https://www.codecademy.com/en/courses/javascript-beginner-en-6LzGd/2/3?curriculum_id=506324b3a7dffd00020bf661


Oops, try again. Hmm, it looks like your nameString() function doesn't return 'Hi, I am Susie' for the name Susie.


function nameString (name)
{
    return ("Hi, I am "+" " + name);
    console.log(name);
}
nameString ("Susie");


#2

"Hi, I am "+" " + name

This line is creating two spaces between "Hi, I am" and the name.


#3

so what is the right one?


#4

function nameString (name)
{
return ("Hi, I am"+" "+name);
console.log(name);
}
nameString ("Susie");

now also its getting error.


#5

function nameString (name)
{
    return ("Hi, I am"+" "+name);
    console.log(name); // <--- This won't be executed
}
nameString ("Susie");

Okay, the other problem is that you've used console.log in the wrong place. return statements end a function, which means that anything after them will not be executed in a function. So what you could do is use console.log with nameString() as the argument, like so:

console.log(nameString("Nick"));

#6

no achievement so far.


#7

What code did you use?


#8

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.