TypeScript · Junior · Question 50 of 75

How do you specify that a function accepts any number of numbers?

Explanation

A rest parameter collects the arguments into an array; its type is an array or a tuple. Call it as sum(1, 2, 3) or sum(...arr).

Further reading

Problem with a question

TypeScript · Junior · question 50

Test yourself

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

Take this quiz