3, Introduction to Functions in JS 11. Functions Recap


#1


Introduction to Functions in JS
11. Functions Recap

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

No matter what i try it keeps saying:

"TypeError: console.log is not a function"


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

Or

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


#2

If console.log is not a function then you probably assigned something else to it. Refresh page to restart the interpreter.


#3

wauww, really a refresh did it! Thanks!

can be closed.


#4

I can't get to make the topic.
I made and the return is this mensage
"it looks like your nameString() function doesn't return 'Hi, I am Susie' for the name Susie".
Who is Susie. I write my name when I call the function by it's wrong.
P.S: sorry my English, I don't speak well.


#5

Hi can you post your code or create a new topic with your code and a link to the lesson.


#6

I already wrote a number of ways.
var nameString = function (name ) {
return "Hi,I am" + " " + name
};
console.log()
nameString("Roberta")

or

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

nameString("Roberta")

this last print this: Hi,I am Roberta
Hi,I am Susie

and always the error mensage come back


#7

Like you said who is Susie? ... it's just a name they use in this lesson to show you how your should be

'Hi, I am Susie'

in your first code

var nameString = function (name ) {
    return "Hi,I am" + " " + name
};

nameString("Roberta")

your return statement should be like that

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

instead of

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

DO you see the difference?
you should put a space after ,

,


#8

Thank you. Now it's right.


#9

Hi, I have a weird problem with #11
the result of the function in the log is this: [Function] , but CodeAcademy says that's well done and I can start next lesson.
the code I've wrote is:


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


if I don't write the last line, the result of the function in the console is correct: "Hi, I am Gabriele", but CodeAcademy warns me that I've done some error because I didn't write the line with console.log!
Weird, isn't it?


#10

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