HTML is mainly text (or call it a string) and javascript variables can be string, number, objects, arrays.
By default, on all those javascript types, if you just place them into a DOM elements, the browser will attempt to convert them to string.
const someNumber = 1
const someString = 'hello'
const someObject = {answer:42}
const someArray = [1, 'help', 3, {a:2}]
document.write(someNumber + '<br/ >')
document.write(someString + '<br/ >')
document.write(someObject + '<br/ >')
document.write(someArray + '<br/ >')
// is the same as 
document.write(someNumber.toString() + '<br/ >')
document.write(someString.toString() + '<br/ >')
document.write(someObject.toString() + '<br/ >')
document.write(someArray.toString() + '<br/ >')
 
 
When you deal with an array, you can use .join to regroup them
for example
const greets = ['allo', 'hello', 'holla'];
function render() {  
  // This write the list separated with comas using join
  document.getElementById('app').innerHTML = greets.join(', ');
  
  // This works too but can be slow and doesn't not allow much flexibility
  document.getElementById('debug').innerHTML = JSON.stringify(greets);
}
render();
setTimeout(() => {
  greets.push('oi');
  render();
}, 1000)
<div id="app"></div>
<pre id="debug"></pre>