I keep encountering an issue when attempting to determine the length of an anonymous array. I am uncertain if this operation is permitted or not.
const gamearena = function ()
{
var matrix = [];
var height = 20;
var width = 10;
while(height--)
matrix.push(new Array(width).fill(0));
return matrix;
};
Whenever I attempt to retrieve the array length, I am confronted with the error message "Cannot read property 'length' of undefined".
I am utilizing NetBeans and although the browser recognizes the constant as an array, it appears that there may be an issue where an anonymous function is concerned. Should I refrain from using an anonymous function in this scenario?