Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to create object from array in JavaScript #183

Closed
LeusMaximus opened this issue Jan 7, 2019 · 4 comments
Closed

How to create object from array in JavaScript #183

LeusMaximus opened this issue Jan 7, 2019 · 4 comments
Labels

Comments

@LeusMaximus
Copy link

I found this answer on stackoverflow. So for How to create object from array in JavaScript case, you can add additional examples:

const apps = ["phone", "calculator", "clock"];
const object = Object.assign({}, apps);

or

const apps = ["phone", "calculator", "clock"];
const object = {...apps};
@jadjoubran
Copy link
Owner

Very good point, thanks!
Would you mind sending a PR with the spread syntax to fix this usecase? And also please update the date: in the YAML header

@LeusMaximus
Copy link
Author

Maybe it makes sense to leave the old version also? Or there is no possibility to leave two examples for one use case?

@jadjoubran
Copy link
Owner

it's not possible as this is geared towards beginners with a link to MDN whenever possible to get more in depth information

@jadjoubran
Copy link
Owner

Use case updated 👍
How to create object from array in JavaScript

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants