How to create tag only once

I have a function, that creates a cells in table automatically. It takes information from array and puts it to the cell. But I don’t know how to create a header cell for this table with a function. Is there a way to create a whole table with one function?
My HTML is next:

<div id="table"> 
   <details>
       <summary class="summary">
           day 1
       </summary>
            <table>
                <tr>
                    <th>name</th>
                    <th>count1 </th>
                    <th>count2</th>
                    <th>count3</th>
                </tr>
                <tr id="createTable"></tr>
            </table>
   </details>
</div>

And function is next:

function addTable(array) { 
    var check_value = array;     
    for(var count in check_value){
        var node = document.createElement('tr');   
        node.innerHTML = '<td class ="tdtable">'+check_value[count][0]+'</td>'+
                         '<td class ="tdtable">'+check_value[count][1]+'</td>'+
                         '<td class ="tdtable">'+check_value[count][2]+'</td>'+
                         '<td class ="tdtable">'+check_value[count][3]+'</td>';
        document.getElementById('createTable').appendChild(node);  
    }
}