-
-
Save bloodyowl/14659ade7cbede2b6dfb to your computer and use it in GitHub Desktop.
ES6 vs ES5
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
const f = ({ foo = "foo", bar = "bar" } = {}, ...args) => ({ | |
foo, | |
[`${ bar }1`]: args, | |
}) | |
// vs | |
var f = function(options) { | |
var args = [].slice.call(arguments, 1) | |
options = options !== undefined ? options : {} | |
var foo = options.foo !== undefined ? options.foo : "foo" | |
var bar = options.bar !== undefined ? options.bar : "bar" | |
var result = { | |
foo: foo, | |
} | |
result[bar + "1"] = args | |
return result | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment