Created
August 22, 2020 12:09
-
-
Save iamsaief/0e810812f1ce2f1e6728abaafd20709a 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
/* 3 dots: spread */ | |
const red = ["π§‘"]; | |
const green = ["π"]; | |
const blue = ["π"]; | |
const rgbHeart = [...red, ...green, ...blue]; | |
console.log(rgbHeart); | |
// Output : ["π§‘", "π", "π"] | |
/* destructure: array */ | |
const hearts = ["π§‘", "π", "π", "π", "π", "π€", "π€"]; | |
const [r, g, b] = [...hearts]; | |
console.log(r, g, b); | |
// Output : 𧑠π π | |
/* destructure: object */ | |
const userInfo = { | |
id: 101, | |
username: "jdoe", | |
name: "Jhon Paul Doe", | |
age: 33, | |
phone: "0123456789", | |
}; | |
const { name, phone } = { ...userInfo }; | |
console.log(name, phone); | |
// Output: Jhon Paul Doe 0123456789 | |
/* Finding min/max */ | |
const numArr = [200, 300, 400, 500, 600]; | |
const min = Math.min(...numArr); | |
const max = Math.max(...numArr); | |
console.log(min, max); | |
// Output: 200 600 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment