This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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} /> |