JavaScript how to let 2 element display at same time

Html tag:

<button id='button'>Export File<button/>
<div id='table_wrapper'>
<table id='table'></table>
</div>

Both of the button tag and table tag are create by JavaScript by :

const table = document.createElement("table");

the button always appears about 3 seconds before the div in the page, is there a way to make the button and div appear at the same time?
Any friend can help ?