How can I combine the output data and make it a string, from a for loop in Javascript.
Here's my snippet.
for (let index = 0; index < routes.length; index++) {
let element = routes[index];
meSpeak.speak(element.narrative, speakConfig);
}
It results,
word1
word2
word3
word4
I want to make it as a one String only. like this
word1 word2 word3 word4
routes.join(' ')?routesand what doesmeSpeak.speak()?routes.forEach(element => meSpeak.speak(element.narrative, speakConfig).join(' ');should work