JavaScript · Junior · Question 59 of 75

What does greet() return?

function greet(name = "guest") {
  return `Hi, ${name}`;
}

Explanation

Default parameters apply when the argument is undefined (missing or passed explicitly). greet(null) gives "Hi, null", because null is a value.

Further reading

Problem with a question

JavaScript · Junior · question 59

Test yourself

Take the JavaScript · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz