No.11 ,


#1

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

};
console.log(nameString("MohamedGhabbour"));

whats wrong with this code ???!!
what is the right code ??


#2

Remove the console log. And just leave the function and the parameter.


#3

var nameString = function (name ) {
return "Hi, I am"+ ""+ name;
};
var newName = nameString("Susie");
console.log(newName);
what's wrong with this code ?


#4

Your code is correct. Only one thing:

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

#5

Actually, your code is fine; simply change it to "Hi, I am", and the error will disappear.


#6

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

Could you please help me out what is wrong in this code?


#7

@swativirmani, problem here:

return console.log("Hi, I am" + " " + name);

Remove console.log:

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

#8

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