Created
March 8, 2018 01:00
-
-
Save christianscott/8b8a9a34557161636c2cc97cb855cbc8 to your computer and use it in GitHub Desktop.
Flip the order of arguments for a function in Javascript
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 flip(fn) { | |
return function () { | |
return fn.apply(null, Array.prototype.reverse.call(arguments)) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment