I generated an array/list of 9 repeating elements to append to a parent element. When I append the list via the spread syntax, it adds it as a single string. When I use the spread syntax without brackets it appends only as a single item (correctly), this is how the documentation shows as well.
append(...nodesOrDOMStrings)
Below you can see what I have so far:
const boardContainer = document.querySelector('#gbContainer');
const boardSquareChild = document.createElement('div');
boardSquareChild.className = "board-square";
boardSquareChild.id = "boardSquare";
boardSqArray = Array(9).fill(boardSquareChild, 0, 9)
boardContainer.append([...boardSqArray])
Any clue why the brackets make it a single string and without the brackets the element is added singularly? I can't find anything in the documentation as to why (at least not via Mozilla), it doesn't seem to be logical behavior as well.