0

データ値を格納するマトリックスを作成しようとしています。

これは私がこれまでに持っているものです:

var Matrix = new function(rows, columns) {
var matrix = [[]];
var i,j;
this.matrix[i].length == columns;
this.matrix[i][j].length == rows;
if(matrix[i] === undefined){
    matrix[i] == 0;
}
}

Matrix.prototype = {
addValue: function (i,j,value) {
this.matrix[i][j].push(value);
console.log(this);
}
}

var m = new Matrix ();

m.addValue(1,1,"this is where I place it");
console.log(m);

このエラーを取り除くことはできません:

TypeError: undefined のプロパティ 'undefined' を読み取れません

提案や修正はありますか?

4

1 に答える 1