devleague / Context-Exercise

Call, Apply, Bind

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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"

About

Call, Apply, Bind


Languages

Language:JavaScript 100.0%