Can this be done in Javascript ?

I want to make an object of this type { keys : values } in javascript using a for-loop but i actually got no idea. Heres a code of what i actually want in python https://code.sololearn.com/cdd7a8vlanMR/?ref=app My Javascript attempt https://code.sololearn.com/WSpO5vxTxcws/?ref=app

10/22/2019 11:56:45 PM

Mirielle🐶 [Inactive]

4 Answers

New Answer


Use reducer method instead. https://code.sololearn.com/WGtbmgLeCkYb/?ref=app




You can use function-constructor. https://code.sololearn.com/WCOAw210O0x4/?ref=app