Last active
September 25, 2022 08:16
-
-
Save buymed-hoangpham/5ca2c70c14a6fab9248abcdec9aa51ae to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| // 5 | |
| const getLocation = (city, country = 'Italy', continent = 'Europe') => | |
| console.log(continent, country, city); | |
| getLocation('Milan'); | |
| // Europe Italy Milan | |
| getLocation('Paris', 'France'); | |
| // Europe France Paris | |
| //6 | |
| const calculatePrice = (total, tax = 0.1, tip = 0.05) => | |
| total + total * tax + total * tip; | |
| //8 | |
| const person = { | |
| first: 'Alberto', | |
| last: 'Montalesi', | |
| }; | |
| const { first, last } = person; | |
| console.log(first, last); | |
| const person = { | |
| ...person, | |
| links:{ | |
| social: { | |
| facebook: "https://www.facebook.com/alberto.montalesi", | |
| }, | |
| website: "http://albertomontalesi.github.io/" | |
| } | |
| } | |
| const { facebook } = person.links.social; | |
| console.log(facebook); | |
| // 12 | |
| const name = 'Alberto'; | |
| const surname = 'Montalesi'; | |
| const age = 25; | |
| const nationality = 'Italian'; | |
| const person = { | |
| name, | |
| surname, | |
| age, | |
| nationality, | |
| }; | |
| console.log(person); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment