ecmascript 6 - es6- arrow function- no duplicate named arguments -


enter image description here

i can't understand last ways of arrow functions have:

no duplicate named arguments- arrow functions cannot have duplicate named arguments in strict or nonstrict mode, opposed nonarrow functions cannot have duplicate named arguments in strict mode.

the above paragraph picked book "understanding ecmascript 6" wrote nicholas c. zakas in 'function' chapter.

according description above, know arrow function has not arguments other function.

i can understand sentence before half, other half start "as opposed to...".

what's mean "nonarrow functions cannot have duplicate named arguments in strict mode."

in fact, functions in strict mode have arguments. have no idea author mean.

it means following valid javascript:

function bar(foo, foo){} 

it not, however, when using strict mode:

'use strict'; function bar(foo, foo){} // syntaxerror: duplicate formal argument foo 

with arrow functions, duplicate named arguments always, regardless of strict or non-strict mode, invalid.

(foo, foo) => {} // syntaxerror: duplicate argument names not allowed in context 

according description above, know arrow function has not arguments other function.

not sure whether understood correctly. arrow functions can have parameters, not have arguments.


Comments

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -