Skip to content

Instantly share code, notes, and snippets.

@ger86
Created July 1, 2020 11:28
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ger86/9b63c2165b2ab3beb6fcd2562680764f to your computer and use it in GitHub Desktop.
Save ger86/9b63c2165b2ab3beb6fcd2562680764f to your computer and use it in GitHub Desktop.
/****************************************************************
*
* ๐Ÿคน๐Ÿปโ€โ™‚๏ธ๐Ÿคน๐Ÿปโ€โ™‚๏ธ๐Ÿคน๐Ÿปโ€โ™‚๏ธ 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