Created
September 7, 2015 07:27
-
-
Save GirlBossRush/0d81a25cd147b5dac4bf to your computer and use it in GitHub Desktop.
Converting a method into a function
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 funcify (method) { | |
return function (self) { | |
return method.apply(self, Array.prototype.slice.call(arguments, 1)) | |
} | |
} | |
const map = funcify(Array.prototype.map) | |
const attributes = map(document.querySelectorAll('div'), element => element.classList) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment