Is there a way to concatenate the output data into a single string from a JavaScript for loop?
Below is the code snippet:
for (let index = 0; index < routes.length; index++) {
let element = routes[index];
meSpeak.speak(element.narrative, speakConfig);
}
The output currently looks like this:
word1
word2
word3
word4
I would like to transform it into a single string, as shown below:
word1 word2 word3 word4