Ad
  • Custom User Avatar

    Thanks for your explanation a lot.
    So, what you mean is that 'this' of vasya's method (if passed to the .every() just as vasya.sell) will be bound to the personInLine which, in return, will not have 'money' object inside causing an error?
    If so, then I got it. But it took me some time.

  • Custom User Avatar

    Because vasya.sell is just the function ( Function Object ), unexecuted, unbound.

    If you want to execute that function with this bound to vasya, you have to bind it and then later execute it, or execute the function as vasya.sell($something) in one expression.

    There is a difference between .every( vasya.sell ) and .every( personInLine => vasya.sell(personInLine) ). Maybe there need not have been a difference, but there is. There's something to be said for ( and against ) both possibilities.

  • Custom User Avatar

    Why do we need to bind vasya's method 'sell' to vasya?