I remember seeing a function on w3school where you can print out all the words of an array and add a space between them, But no matter how much I google I can't find it.
Example of how it could look:
function printWords() {
var array = ["Car", "Bus", "Motorcykle"];
print(array.addSpaces());
}
Use Array.prototype.join()
. You can specify a character to put between the values, in your case:
array.join(' ');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With