Skip to content

Instantly share code, notes, and snippets.

@bloodyowl
Created Sep 7, 2015
Embed
What would you like to do?
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