When I call renderFrame, trying to access newLine[i] throws an error of 
Uncaught TypeError: Cannot read property '0' of undefined
Why is this? I've included the relevant code.
rows : ["-","-","-","-","-","-","-","-","-","-",],
generateLine : function(){
    var result = new Array(10);
    for(var i = 0; i < result.length; i++){
        result[i] = " ";
    }
},
renderFrame : function(){
    var newLine = this.generateLine();
    for(var i = 0; i < this.rows.length; i++){
        console.log(newLine[i]);
    }
},
                You forgot
return result;
at the end of generateLine()
So newLine is now undefined. Hence Cannot read property '0' of undefined
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With