ES6 Function Parameters

In ES6 there are multiple enhancements in defining function parameters - default, rest and spread.

Default


You can set a default value for a function parameter.


Rest


First parameter of a function can be assigned to a variable and ‘rest’ to an array.

Spread


The element of an array parameter can be extracted and assigned to variables.

Share