Skip to content

Instantly share code, notes, and snippets.

@joeheyming
Created February 20, 2014 20:02
Show Gist options
  • Save joeheyming/9122035 to your computer and use it in GitHub Desktop.
Save joeheyming/9122035 to your computer and use it in GitHub Desktop.
javascript namedArgs shim
function namedArgsFunc() {
var args = {};
for (var i = 0, len = arguments.length; i < len; i += 2) {
args[arguments[i]] = arguments[i+1];
}
console.log(args);
}
> namedArgsFunc('a', 1, 'b', 2)
Object {a: 1, b: 2}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment