Created
July 1, 2020 11:28
-
-
Save ger86/9b63c2165b2ab3beb6fcd2562680764f 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
/**************************************************************** | |
* | |
* ๐คน๐ปโโ๏ธ๐คน๐ปโโ๏ธ๐คน๐ปโโ๏ธ Object & Entries ๐คน๐ปโโ๏ธ๐คน๐ปโโ๏ธ๐คน๐ปโโ๏ธ | |
* | |
****************************************************************/ | |
/** | |
* 1๏ธโฃ Object.entries | |
*/ | |
const firstDayMeals = { | |
breakfast: "โ๏ธ", | |
brunch: "๐", | |
lunch: "๐ฒ", | |
snack: "๐ซ", | |
dinner: "๐ฅ", | |
}; | |
const firstDayMealsEntries = Object.entries(firstDayMeals); | |
// [["breakfast", "โ๏ธ"], ["brunch", "๐"], ["lunch", "๐ฒ"], ["snack", "๐ซ"], ["dinner", "๐ฅ"]] | |
/** | |
* 2๏ธโฃ Object.fromEntries | |
*/ | |
const secondDayMealsEntries = [ | |
["breakfast", "๐"], | |
["brunch", "๐ฅช"], | |
["lunch", "๐ฎ"], | |
["snack", "๐ฅ"], | |
["dinner", "๐ฅ"], | |
]; | |
const secondDayMeals = Object.fromEntries(secondDayMealsEntries); | |
console.log(secondDayMeals); | |
/** | |
{ | |
breakfast: "๐", | |
brunch: "๐ฅช", | |
dinner: "๐ฅ", | |
lunch: "๐ฎ", | |
snack: "๐ฅ" | |
} | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment