Created
April 12, 2017 15:48
-
-
Save agjs/35b41de8d6c17f08fb0f1b99b485d4c4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function foo(role, level) { | |
console.log(`Your role is ${role} and your level is ${level}.`); | |
console.log(this); | |
} | |
foo(); | |
var person = { | |
name: 'Julie' | |
}; | |
foo.call(person, 'developer', 'pro'); | |
foo.apply(person, ['developer', 'pro']); | |
const whoIs = foo.bind(person); | |
whoIs('developer', 'pro'); | |
function multiply(a, b) { | |
return a * b; | |
} | |
const double = multiply.bind(null, 2); | |
console.log(double(3)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment