Signup/Sign In
Ask Question
Not satisfied by the Answer? Still looking for a better solution?

JS Lesson 8 Level 5

Can someone please explain what is wrong with my code. When I run it, it works properly but when I submit it, it shows

Provide name parameter with default value for greet() function.

Here's my code

function greet(name = "NULL")
{
if(name != "NULL")
{
console.log("Hello "+name+"! Thanks for joining us.");
}
else {
console.log("What is your name?");
}
}
// call the function
greet("Jake");
by

1 Answer

kshitijrana14
try this one ( level 8 lesson 5):

function greet(name="NULL")
{
if(name!="NULL")
{
console.log("Hello "+name+"! Thanks for joining us.");
}
else {
console.log("What is your name?");
}
}
greet("EKROOP");// call the function

Login / Signup to Answer the Question.