I am trying to create JSON object entered into textbox using below code.
colnames is array of columns from table colnames = [DEPTNO,DNAME],
I am trying to create JSON object dynamically. e.g.
tableInsert.DEPTNO = 100; tableInsert.DNAME= sales;
but when i run it, it always complain console.log (eval ("tableInsert." + col)); is undefined. Any help..
  document.getElementById("insercols").onclick = function(){
    var tableInsert ='';
    var colvalue='';
    console.log("cols are " + colnames);
    for (col of colnames){
        colvalue = document.getElementById(col).value;
        eval ("tableInsert." + col + " = " + "typeof "+  colvalue);
        console.log("tableInsert." + col + " = " + "typeof "+  colvalue);
        console.log (eval ("tableInsert."  + col));
    }
}
 
     
    