make an array of objects to array of string javascript code example
Example 1: convert array of string to array of objects javascript
myArray = myArray.map((str, index) => ({ value: str, id: index + 1 }));
Example 2: js array with objects to string
var array = new Array(); //new Array not necessary
var string;
array[0] = {key: value};
array[1] = {key1: value1};
string = JSON.stringify(array);
/*
string should look like
[{"key":"value"},{"key1":"value1"}]
*/