11. Functions recap

<PLEASE USE THE FOLLOWING TEMPLATE TO HELP YOU CREATE A GREAT POST!>

<Below this line, add a link to the EXACT exercise that you are stuck at.>

<In what way does your code behave incorrectly? Include ALL error messages.>

```

Hi
my code keeps telling me i haven’t printed anything in the console, although it clearly says: Hi, I am Cameron.

var nameString = function (name) {
return "Hi, I am " + “” + name

};
nameString(“cameron”)

<do not remove the three backticks above>
1 Like

Use the console.log method to print to the console.

I will give you a hint and say you need to wrap something already in your code, inside a console.log() statement

3 Likes

but still it wont show HI I am cameron

1 Like

Try wrapping your return in ()

return(“blahblah”);

and print nameString to console…

console.log(nameString(“cameron”);

Hi, guys, I have the same problem :
var nameString = function (name) {
return “Hi,I am” + " " + name;
};

console.log(nameString(“ela”));

Can you tell me what’s wrong?

never mind, it was a SPACE missing between Hi, I

ok so i keep getting this error message "Oops, try again. Hmm, it looks like your nameString() function doesn’t return ‘Hi, I am Susie’ for the name Susie."when my console and program is clearly working at it displays “Hi, i am Susie”

var nameString = function (name) {
return (“Hi, i am” + " " + name);
};
console.log = nameString(“Susie”);

Capital I for i need to have the correct spellings/punctuation.

and never put console.log = something

it should be

console.log(nameString(“Susie”)):

so now whats the problem?

I’m having similar issues… with the code below (leaving out the console.log portion) it is telling me that nothing is printing… which I understand.

var nameString = function (name) {

return (“Hi, I am” + " " + name);

};

nameString(“Dave”)

When I add the proper console.log portion, as I keep seeing in the forum threads for question #11, it is telling me that “TypeError: console.log is not a function”

var nameString = function (name) {

return (“Hi, I am” + " " + name);

};

console.log(nameString(“Dave”));

… Please help me to understand what I’m doing wrong here.

Refresh the page and resubmit, you overwrite the function of console.log by putting it as console.log = .

1 Like

Hey db,

If you refresh and resubmit that should work, you can clearly see here that your code works fine

(click run with js on the right)

hehe you were right thanks for the refresh the page tips

1 Like

Hi there,
your method worked but there’s one question need to ask… what is the need of “nameString” inside console.log() as in 'console.log(nameString(“cameron”); ’

I love how cool your background is. :smiley:

Weird thing. I think my code is right, but I get an error: ‘Oops, try again. Hmm, it looks like your nameString() function doesn’t return ‘Hi, I am Susie’ for the name Susie.’

var nameString = function (name) {
console.log(“Hi, I am” + " " + name);
};
console.log (nameString(“Yulia”));

Who’s that Susie and what is she doing in my code? 0_o

var nameString = function (name) {
console.log("Hi, I am " + “” + name);
return ("Hi, I am " + “” + name);
}

nameString(“Susie”);

I use this code pass!

You dont need the + “” part because you wrote I am " which is giving it the space already,

"Hi, I am " + name or “Hi, I am” + " " + name

Hope you understand what I’m trying to say

Give it a refresh and try to resubmit, if that doesn’t work it might be the issue of spacing things

Try this

var nameString = function(name) {
console.log("Hi, I am" + " " + name);
};
console.log(nameString("Yulia"));
1 Like

Thank you! I’ve copied code from another topic, so now I’m called Al :slight_smile: It has worked.

1 Like