Created
October 7, 2022 17:14
-
-
Save bnse/631c070baee6d08bd75465e2fed0371d to your computer and use it in GitHub Desktop.
change array to array[object]
This file contains hidden or 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 people = [ | |
| 'string 1', | |
| 'string 2', | |
| 'string 3', | |
| 'string 4', | |
| 'string 5', | |
| 'string 6', | |
| ] | |
| let peopleObj = [] | |
| for (let index in people) { | |
| let data = { key: index, data: people[index] } | |
| peopleObj.push(data) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment