Created
November 9, 2014 01:29
-
-
Save snippe/3c68ab9a1331856917d4 to your computer and use it in GitHub Desktop.
This file contains 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
var first_object = { | |
num: 4 | |
}; | |
function multi(mul) { | |
return this.num * mul; | |
} | |
Function.prototype.bind = function (obj) { | |
var method = this, | |
temp = function () { | |
return method.apply(obj, arguments); | |
}; | |
return temp; | |
} | |
var first_mul = multi.bind(first_object); | |
console.log(first_mul(5)); //20 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment