Skip to content

Instantly share code, notes, and snippets.

View sewerynkalemba's full-sized avatar
😄

Seweryn Kalemba sewerynkalemba

😄
View GitHub Profile
// const obj = {x: 3.6, y: 7.8}
// makeCalculation(obj)
function makeCalculation({x, y: d, z = 4}) {
return Math.floor((x + d + z) / 3)
}
// to jest to samo, co:
function makeCalculation(obj) {
const {x, y: d, z = 4} = obj
const getFive = () => 5
const addFive = a => a + 5
const divide = (a, b) => a / b
// to jest to samo, co:
function getFive() {
return 5
}
function addFive(a) {
return a + 5
const a = 'witaj'
const b = 42
const c = {d: [true, false]}
console.log({a, b, c})
// to jest to samo, co:
console.log({a: a, b: b, c: c})
// w Reactcie:
function Counter({initialCount, step}) {
const greeting = 'Witaj'
const subject = 'Świecie'
console.log(`${greeting} ${subject}!`) // Witaj Świecie!
// to jest to samo, co:
console.log(greeting + ' ' + subject + '!')
// w Reactcie:
function Box({className, ...props}) {
return <div className={`box ${className}`} {...props} />