Why the function is called?

Here is the script itself create the table,naschel on one site, checked, everything works! just do not understand why a function aber() next onclick vyzyvaetsya yourself? After all, it's not a challenge, and an announcement!
var tdCount = 10;
 function createTable()
{
 var x = window.addTable;
 create(x.tBodies[0] || x,5);
create(x.createTHead(),2);
create(x.createTFoot(),3);
 function create(section, trCount)
{
 var n;
 for(var i=0,tr; i<trcount; i++) { tr="section.insertRow(i);" tr.onclick=function aber(){x.deleterow(this.rowindex);} for(var j="0;" < tdcount; j++) n="tr.insertCell(j);" n.innerhtml="Done" ; } }< code></trcount;>
July 2nd 19 at 18:20
1 answer
July 2nd 19 at 18:22



 <meta charset="utf-8">
<title>TEST</title>
<style>
table{
 border-collapse: collapse;
}
td{
padding:10px;
 border: 1px solid black;
}
caption{
 background: #f40;
 padding:0 50px;
 margin:50px 0 0;
 border: 1px solid black;
 border-bottom-width: 1px;
}
</style>
the <script>
 var tdCount = 10;
 function createTable()
{
 var x = window.addTable;
 create(x.tBodies[0] || x,5);
create(x.createTHead(),2);
create(x.createTFoot(),3);
 function create(section, trCount)
{
 var n;
 for(var i=0,tr; i<trCount; i++)
{
 tr = section.insertRow(i);
 tr.onclick = function aber(){x.deleteRow(this.rowIndex);}
 for(var j=0; j < tdCount; j++)
{
 n = tr.insertCell(j);
 n.innerHTML = "Done";
}
}
}
}
</script>


 <a href="javascript:createTable()">Ավելացնել շարք</a>
 <table id="addTable">
<caption>Աղյուսակ</caption>
</table>

Find more questions by tags JavaScript