number is of type array which stores some numbers when called addNumber function and displays that array in another table which has a row with id as "output".Right now in my single td element of table all the elements of the array are printed but i need to print single array element to single td element. How can I achieve this?
Html
<table>
<tr>
<td id="output"></td> // I want every element of the array to print in single //td element.right now all elements of the array are printing in first td element.
<td></td>
<td></td>
... and do on
</tr>
</table>
<table>
<tr>
<td onClick="addNumber(1)">1</td>
<td onClick="addNumber(2)">2</td>
<td onClick="addNumber(3)">3</td>
</tr>
<tr>
<td>4</td>
<td>5</td>
<td>6</td>
</tr>
</table>
javascript
let number = [];
function addNumber( num) {
number.push(num);
console.log( number );
document.getElementById("output").innerHTML = number;
}