To convert an array into an object in JavaScript, do this:
Object.assign({}, array)
.Here's how you do it:
const array = [ 'Hello', 'World', '!' ];
const object = Object.assign({}, array);
// {0: 'Hello', 1: 'World', 2: '!'}
console.log(object);