Stuck on 11


#1

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

My code works and appears on screen, However the message says "looks like you didn't print anything to the console" Even though I did!!


#2

Return statements are tricky. You only use them in functions. They don't actually display something in the console. That's why console.log statements exist. For example, let's say you have a function:

var function1= function(){
return 1+1;
}

Calling function1 would return 2 but nothing would log to the console. To log this to the console, you would have to write:

console.log(function1());

And then it would display

2

Also, this line of code will not run after a return statement. If you were to have it run first in your function, it would but the return statement still wouldn't log to the console. I would remove it.


#3

thanks again!! :smiley:


#4

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