In11- Function recap section , I 'l told I have the bad solution yet it returns the good answer


#1

In11- Function recap section , I 'l told I have the bad solution yet it returns the good answer . So I don't understand .


#2

Your code:

return "Hi I am " + " " + name;

The correct code:

return "Hi, I am" + " " + name;

See I you can figure out why! :smiley:


#3

Thanks Lolman ! The difference was just the coma ? Wahoo ! thanks a lot ; i m going to check


#4

Doesn't work . The problem is different . it was running good but the solution is displayed to be false . Look at the picture joined .


#5

The problem is the program is expecting an EXACT response. All letters need to be perfectly as it portrayed.

return "Hi, I am" + " " + name;

exactly like that, it can't have any extra spaces after "am" or be missing a comma. Everything has to be perfect.


#6

Actually, why don't you just console.log the statement instead of return it?

Console.log("Hi, I am" + " " + name);

nameString("Susie");

#7

In your solution you didn't call the function . You make a mix between calling the function and print out .
But you're right when you say that it must be copy exactly the same string . But I did !


#8

IT WORKS !!! Just Now ! Because I ve just copy-past the string ! But usually I don't have to ? So im surprised .
I wrote
nameString(name);
console.log("Susie");
It's very funny because it doesn't return "HI , I am susie" but only "Susie" and the answer is accepted ???
Look the picture

!


#9

You error was this:

var newName=nameString ("Susie");

When calling a function you mustn't leave a space between the call and the brackets. So your function should've looked like this:

var newName=nameString("Susie");