So I have an array of strings like this:
myData = ["111", "222", "333"]
I want to build a string having this structure:
"{
"111" : [{"type" : "line"}],
"222" : [{"type" : "line"}],
"333" : [{"type" : "line"}],
}"
Basically, for each element in array to add that type and line which are the same for all, and put it inside curly brackets, all this being a string.
This is my unsuccessful approach until now:
let result ="{";
myData.forEach(
result = result + '"' + baselineTitle + '" [{"type":"line"}]';
);
result = result + "}"

JSON.stringifyit.