listing the createtable function var tabletemplate $(""""""join('\ '))createtable function(data,variablesintable,title)var table tabletemplate clone()var ths variablesintable map(function(vreturn $(""text( })$('caption'tabletext(title)$('thead tr'tableappend(ths)data foreach(function(rowvar tr $(""appendto($('tbody'table))variablesintable foreach(function(varnamevar val rowkeys varname split(')keys foreach(function(keyval val[key})tr append($(""text(val))})})return tablecreatetable(requires three argumentsdata--the data it needs to put into table variablesintable--what variables it needs to show title--the title of the table it' always nice to know what you're looking at createtable(uses predefined variabletabletemplatethat contains our overall table layout createtable(can then add rows of data to this template now that you have your utilitieslet' get to the main function of the applicationas shown in the following listing listing javascript main function main function(inputdata)var medicinedata inputdata put the variables we'll show in the table in an array so we can loop through them when creating table code our datanormally this is fetched from server but in this case we read it from local csv file var dateformat time format("% /% /% ")convert date to correct medicinedata foreach(function (dformat so crossfilter will day dateformat parse( date)recognize date variable }var variablesintable only show ['medname','stockin','stockout','stock','date','lightsen'sample of data var sample medicinedata slice( , )var inputtable $("#inputtable")create table