In this tutorial I give you simple example of convert array to object using JavaScript with using example. In this We will use Object.assign() for convert array into json object using javascript. I have to just pass object as argument in Object.assign(). i will give you very simple example how you can easily convert array into object in jQuery.
Example:
<!DOCTYPE html>
<html>
<head>
<title>Array to Object convert using Javascript </title>
</head>
<body>
<script>
var getAll = [
'Bokaro',
'Delhi',
'Patna',
'Kolkata',
];
var myObject = Object.assign({}, getAll);
console.log(myObject);
</script>
</body>
</html>
Output :-
![](https://www.devopsfreelancer.com/blog/wp-content/uploads/2023/06/image-37-1024x524.png)
Thanks for reading.