There is a way to solve the ultimate problem of conversion arrays and objects
The following two examples are es6 syntax.
- It is converted into an array of objects:
knowledge: Extended operator ...
let arr = [1,2,3];
let obj = {...arr};
console.log(obj); //{0: 1, 1: 2, 2: 3}
- Objects into an array
of knowledge points: Object.values (obj)
var obj = { 0: 'a', 1: 'b', 2: 'c' };
console.log(Object.values(obj)); // ['a', 'b', 'c']