Answers for "js array to object values"

5

js array into object

const names = ['Alex', 'Bob', 'Johny', 'Atta'];

// convert array to th object
const obj = Object.assign({}, names);

// print object
console.log(obj);

// {0: "Alex", 1: "Bob", 2: "Johny", 3: "Atta"}
Posted by: Guest on October-25-2020

Code answers related to "js array to object values"

Code answers related to "Javascript"

Browse Popular Code Answers by Language