Created
November 9, 2015 20:52
-
-
Save marcusandre/486e4cfe641928481c4b to your computer and use it in GitHub Desktop.
get last argument from arguments list if it is a function
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
function dummy () { | |
var args = [].slice.call(arguments) | |
var fn = typeof args[args.length - 1] === 'function' ? args.pop() : null | |
// ... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment