Skip to content

Instantly share code, notes, and snippets.

@bloodyowl
Created September 7, 2015 09:23
Show Gist options
  • Save bloodyowl/14659ade7cbede2b6dfb to your computer and use it in GitHub Desktop.
Save bloodyowl/14659ade7cbede2b6dfb to your computer and use it in GitHub Desktop.
ES6 vs ES5
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