Advertisement

Effective Function Signatures with Default and Rest Parameters

  • Raju Gandhi
Chapter

Abstract

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.

Copyright information

© Raju Gandhi 2019

Authors and Affiliations

  • Raju Gandhi
    • 1
  1. 1.ColumbusUSA

Personalised recommendations