These new operators, both represented by dot dot dot, has two purpose, to gather arguments, or spread them.
One quick note about the gather operator, it is sometimes referred to as the 'rest' operator, not the verb resting, but rest as a noun.
In the context of a function declaration, a ... before a variable with gather all the arguments in one variable.
In the context of a function invocation, a ... operator would spread them out, as arguments passed in.
One quick note about the gather operator, it is sometimes referred to as the 'rest' operator, not the verb resting, but rest as a noun.
In the context of a function declaration, a ... before a variable with gather all the arguments in one variable.
In the context of a function invocation, a ... operator would spread them out, as arguments passed in.
Comments
Post a Comment