Skip to content

Instantly share code, notes, and snippets.

@NovoManu
Created March 13, 2021 08:00
Show Gist options
  • Save NovoManu/5c3f7be6cb1fca27908744f49f9fe8b3 to your computer and use it in GitHub Desktop.
Save NovoManu/5c3f7be6cb1fca27908744f49f9fe8b3 to your computer and use it in GitHub Desktop.
// One line return
const increment1 = (number) => ++number
// or without parentheses
const increment2 = number => ++number
// Analog in ES5
var increment3 = function(number) {
return ++number
}
// One line return object
const returnObj1 = () => ({ a: 1, b: 2 })
// Analog in ES5
var returnObj2 = function() {
return { a: 1, b: 2 }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment