javascript - TypeError: Cannot read property '0' of undefined -


when call renderframe, trying access newline[i] throws error of

uncaught typeerror: cannot read property '0' of undefined 

why this? i've included relevant code.

rows : ["-","-","-","-","-","-","-","-","-","-",],  generateline : function(){     var result = new array(10);     for(var = 0; < result.length; i++){         result[i] = " ";     } },  renderframe : function(){     var newline = this.generateline();     for(var = 0; < this.rows.length; i++){         console.log(newline[i]);     } }, 

you forgot

return result; 

at end of generateline()

so newline undefined. hence cannot read property '0' of undefined


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -