Created
December 3, 2020 17:36
-
-
Save sewerynkalemba/3dc58a310cb57f0b5bb31ce6ed9a5cc4 to your computer and use it in GitHub Desktop.
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 | |
return Math.floor((x + d + z) / 3) | |
} | |
// co równa się temu: | |
function makeCalculation(obj) { | |
const x = obj.x | |
const d = obj.y | |
const z = obj.z === undefined ? 4 : obj.z | |
return Math.floor((x + d + z) / 3) | |
} | |
// w Reactcie: | |
function UserGitHubImg({username = 'ghost', ...props}) { | |
return <img src={`https://github.com/${username}.png`} {...props} /> | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment