Created
September 24, 2020 12:17
-
-
Save ekrem-aktas/11fd9c6366f497bb78715d17f26a0d8d 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 members = [["name", "apple"], ["type", "fruit"]]; | |
const food = members.reduce((obj, [key, value]) => { | |
obj[key] = value; | |
return obj; | |
}, Object.create(null)); | |
console.log(food); // { name: "apple", type: "fruit" } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment