lib/fixed-2d-array.js
function Fixed2DArray(rows, cols, defaultValue) {
  if(rows <= 0 || cols <= 0){
    throw new Error('fixed-2d-array: Must have more then 0 rows and 0 columns.');
  }

  this._width = cols;
  this._height = rows;
  this._grid = [];

  for (var i = 0; i < rows; i++) {
    this._grid[i] = [];
    for (var j = 0; j < cols; j++) {
      this._grid[i][j] = defaultValue;
    }
  }
}
function Fixed2DArray(rows, cols, defaultValue) {
  if(rows <= 0 || cols <= 0){
    throw new Error('fixed-2d-array: Must have more then 0 rows and 0 columns.');
  }

  this._width = cols;
  this._height = rows;
  this._grid = [];

  for (var i = 0; i < rows; i++) {
    this._grid[i] = [];
    for (var j = 0; j < cols; j++) {
      this._grid[i][j] = defaultValue;
    }
  }
}
function Fixed2DArray ( rows , cols , defaultValue ) { if ( rows <= 0 || cols <= 0 ) { throw new Error ( 'fixed-2d-array: Must have more then 0 rows and 0 columns.' ) ; } this . _width = cols ; this . _height = rows ; this . _grid = [ ] ; for ( var i = 0 ; i < rows ; i ++ ) { this . _grid [ i ] = [ ] ; for ( var j = 0 ; j < cols ; j ++ ) { this . _grid [ i ] [ j ] = defaultValue ; } } }
An array with a fixed height and width.

@param row {number} number of rows, corresponds to the height.
@param cols {number} number of columns, corresponds to the width.
@param defaultValue the initial value for the array elements
@class
An array with a fixed height and width .