I'm a Python programmer, and learning how to write clean codes in JavaScript. I want to replicate the following python code using Javascript code:
array = [...] # some array
foo = [ x.data for x in array ]
>>> foo = [ obj_1, obj_2, obj_3 ... ]
someDict = {'key_1': [0,1], 'key_2': [3,4], 'key_3': [5,6]}
bar = [{key: someDict[key][i] for key in someDict.keys()} for i in range(2)]
>>> bar = [{'key_1': 0, 'key_2': 3, 'key_3': 5},
{'key_1': 1, 'key_2': 4, 'key_3': 6}]
Is there any 'clean' way translating the above python code into a javascript code? Hopefully in one-line, not using 3-4 lines of for-loop code