Created
July 10, 2011 03:11
-
-
Save insin/1074217 to your computer and use it in GitHub Desktop.
Yo dawg, I heard you like call() and apply()...
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
| // Call apply() in the context of document.getElementById with the arguments: document, ['header'] | |
| Function.prototype.apply.call(document.getElementById, document, ['header']) | |
| // Apply apply() in the context of document.getElementById with the arguments: document, ['header'] | |
| Function.prototype.apply.apply(document.getElementById, [document, ['header'])) | |
| // Call call() in the context of document.getElementById with the arguments: document, header | |
| Function.prototype.call.call(document.getElementById, document, 'header') | |
| // Apply call() in the context of document.getElementById with the arguments: document, header | |
| Function.prototype.call.apply(document.getElementById, [document, 'header']) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment