How to remove the commas in arrays javascript [closed]

  arrays, javascript

I would like to know whether I can remove the commas when printing out the output.

This is my code:

var allRows = [];
var numberOfRows = 10;

var number = 0;
while (number < numberOfRows) {
  allRows[allRows.length] = "O";
  number++;
}

var numberOfRowsNumber = 0;

while (numberOfRowsNumber < numberOfRows) {
  var paragraph = document.createElement("p");
  var txt = document.createTextNode(allRows);
  paragraph.appendChild(txt);
  var element = document.getElementById("output");
  element.appendChild(paragraph);
  numberOfRowsNumber++;
}

This is the output of the above code:

My expected output would be the following:

Any help would be appreciated!

Source: Ask Javascript Questions

LEAVE A COMMENT