why limit is 20 rather than el=20 because in isFullAge.bind(this,20) in which 20 is the last argument ,so it has to pass to \'el\' parameter,but why it is set to \'limit\' param
The first argument becomes the this
value. Each subsequent value is mapped onto the arguments in order, left to right. They are not assigned from the end backwards.
20
is the first argument after the this
value in the call to bind
so it is assigned to limit
because limit
is the first argument.
Had you said:
isFullAge.bind(this, 20, example))
… then example
would be assigned to el
because el
is the second argument and example
would be the second argument after the this
value.