Skip to content

Instantly share code, notes, and snippets.

@kopylovvlad
Last active April 30, 2017 12:56
Show Gist options
  • Select an option

  • Save kopylovvlad/82cca824b6f3328776c4ae98aa5492c5 to your computer and use it in GitHub Desktop.

Select an option

Save kopylovvlad/82cca824b6f3328776c4ae98aa5492c5 to your computer and use it in GitHub Desktop.
'use strict'
const square = (x = 0) => {
return x * x
}
const sum = (x = 0, y = 0) => {
return x + y
}
console.log(square(2))
console.log(square())
console.log(sum(10, 5))
console.log(sum(3, 7))
let name = 'John'
let lastName = 'Smith'
const makeUser = ({ name, lastName }) => {
let user = { name, lastName }
return user
}
console.log(makeUser({ name, lastName }))
const adding = (...numbers) => {
let sum = 0
for (let number of numbers) {
sum += number
}
return sum
}
console.log(adding(1,2,3,4,5))
console.log(adding(14,16,9))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment