Explore Library
Code QuizBeginner

Optional Parameter Ordering

Spot why placing an optional parameter before a required one fails to compile in TypeScript.

Codetypescript
function greet(greeting?: string, name: string): string {
  return `${greeting ?? "Hello"}, ${name}!`;
}

console.log(greet("Hi", "Ada"));

What is the bug in this code?