I'm trying to understand how constructors works. Here is the first part of my table constructor:
function build(rowsNum,cellsNum,id){
this.id=document.getElementById(id);
this.addRow=function(){
var row=id.insertRow();
for(var j=0;j<cellsNum.length;j++){
var cell=row.insertCell();
}
};
}
var test=new build(1,2,firsttbody);
test.addRow();
The problem is that the method test.addRow(); don't add cells. I have already checked that my browser supports insertCell(), but I can't understand, what is wrong. In console there are no errors.