/Context-Exercise

Call, Apply, Bind

Primary LanguageJavaScript

Context-Exercise

  1. invoke the add function with 2 arguments, 0 and 1
  2. invoke the add function within the context of the object named voltron, passing in 2 arguments, 2 and 3 (using call())
  3. invoke the add function within the context of the object named optimus, passing in 2 arguments, 20 and 30 (using apply())
  4. bind the function add to a new function named calculate with the context of the object bender (using bind())
    invoke the calculate passing in 2 arguments, "drinking " and "beer"