Created
May 17, 2010 22:20
-
-
Save brianleroux/404309 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
// this is just a really silly way of saying this | |
Function.prototype.call.apply(function (a) {return a}, [1,2]) | |
// 2 | |
// if this still seems weird to you. Consider this: | |
function logThisAndArgs(){ console.log(this, arguments); } | |
Function.prototype.call.apply(logThisAndArgs, [{'some':'object'},1,2,3,4]) | |
// logs -> Object { some="object"} [1, 2, 3, 4] | |
// or this! | |
Function.prototype.call.call(logThisAndArgs, {'some':'object'},1,2,3,4) | |
// logs -> Object { some="object"} [1, 2, 3, 4] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment