Effective Function Signatures with Default and Rest Parameters

Raju Gandhi · Apress eBooks · 2019

We all realize the pervasive use of functions in JavaScript. Consequently, defining functions and laying out function signatures is one thing we do a lot. Default parameters, a new feature introduced in ES6, provide us the power to improve how we detail our function signatures. They allow us to specify what the value of a parameter to a function ought to be if no value is passed in at invocation time. Along the same vein, rest parameters allow us to express that a function (or method) has no expectation to the number of arguments you can supply it—in other words, they allow us to explicitly declare variadic functions.

Read the paper · More papers on PaperTik