add table header dynamically in jquery

JavaScript
var temp = new Array();

temp.push("text1");
temp.push("text2");
var i =0;
 $("#Table th").each(function () {

     $(this).text(temp[i])
     i++;
 })    $("#Table th").each(function () {

     $(this).text("Dummy text")
 })
Source

Also in JavaScript: