I dont see what i am doing wrong here?


#1

i dont see what i am doing wrong here??

Write a function called nameString()
It should take name as a parameter.
The function returns a string equal to "Hi, I am" + " " + name.
Call nameString() by passing it your name, and use console.log to print the output.

var nameString = function (name) {

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

};

nameString("Bobby");

error on console =

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


#2

Check the spacing in the string that the function is returning.


#3

First let's create a new function:

var varName = function (functionName) {
  ...
}

Now let's print something:

var varName = function (functionName) {
  console.log("your phrase");
}

Add something else:

var varName - function (functionName) {
  console.log("your phrase" + " " + add);
}

And set add to be Susie. Your code should look like this:

var helloOne = function (helloTwo) {
  console.log("Hi, I am" + " " + add);
}

add("name");

#4

Let's rather say parameter instead of functionName as what you called varName is the function name:

var functionName = function (parameterName) {
  ...
}

this makes no sense as add is not defined. Better use the paramter we recently defined:

var functionName = function (parameterName) {
  console.log("your phrase" + " " + parameterName);
}

This is really confusing even to me could you elaborate on this one?


#5

Ok, I see you don't like my answers. I'll stop.


#6

It's nothing personal and the least thing I want is making you stop comment. The general structure of your answer is good, it's just that it is very confusing and partially wrong so I felt like I should clarify it.


#7

Well, ok. Thanks for helping me, I will try to be more organised.