TypeScript · Junior · Question 74 of 75
What type does a function parameter with a default value get?
function paginate(page = 1) { /* ... */ }- ✓Correct answer: It's inferred from the default (
number) and becomes optional for callers - 2
any - 3It's required and must be annotated
Explanation
Callers may omit the argument or pass undefined; inside the function page is always a number.