I'm trying to write some objects using JavaScript. I have 1 small object that appears to be working but this object needs a multi-dimensional array.
When I try to use this snippet of this object my browser crashes...
Are there any good tutorials on how to write objects in javascript?
function map(sizeX, sizeY)
{
var cityArr = new Array();
this.sizeX = sizeX;
this.sizeY = sizeY;
this.generateCity = generateCity;
var cityXY = new Array();
function generateCity(cityNum)
{
alert(cityNum);
}
}
When I call this, it fails when I add the call to generateCity method my browser cashes.
var objMap = new map();
//objMap.generateCity(2);
What am I doing wrong?