Can anyone help me to write the below code? Question about 11/13


#1

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


#2

If I gave you the code directly, it would not help you as you can simply copy it. I encourage you to tell us the exact step above wherein you face a problem.


#3

Hi Gaurang,

I have tried and finally i debug my code..

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

nameString("Vikram");
console.log(nameString("Vikram"));


#4

That's redundant: as http://discuss.codecademy.com/t/console-log-the-results-of-a-function-11-13-introduction-to-functions-in-js/1275/2 makes clear, all that was necessary is console.log(nameString("Vikram")); -- just one line....

(And as I noted in that thread, I blame Code Academy/Leng Lee [the author of these lessons] for not having considered a beginner's mindset in this exercise.)


#5

Thank You @dc_super_rich for sharing the link..It really help me to clear my concepts..