# Function to create a table from an array

In the previous lessons, we made the createTable function, which creates a table of a given size. Let's now make the `createTableByArr` function, which will take a two-dimensional array as a parameter and build a table based on it.

That is, the above code of the previous lesson is converted into this:

`let div = document.querySelector('#elem'); let arr = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]; let table = createTableByArr(arr); div.appendChild(table);`

The result of executing this code should be the following table:

`<div id="elem"> <table> <tr> <td>1</td> <td>2</td> <td>3</td> </tr> <tr> <td>4</td> <td>5</td> <td>6</td> </tr> <tr> <td>7</td> <td>8</td> <td>9</td> </tr> </table> </div>`

Implement the described function. Check out its work.

←→
↑
en ru