Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript convert array to object

// Also, the following works well:
// IF the array came as follows (you cannot declare an array like that)
const obj = Object.assign({}, ['name': 'Alex', 'age': 43, 'gender': 'male']);
console.log(obj);
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #javascript #convert #array #object
ADD COMMENT
Topic
Name
8+2 =