Last active
March 17, 2017 09:50
-
-
Save shockwaves/6648791da3201e1a594ac99761d8f01a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let Table = { | |
increment: 0, | |
init(rows,columns){ | |
this.rows = rows; | |
this.columns = columns; | |
this.matrix = this.generateMatrix(); | |
}, | |
generateMatrix(){ | |
let arr = []; | |
for(let i=0; i<this.columns; i++){ | |
arr[i] = new Array(this.columns); | |
for(let j=0; j<this.rows; j++){ | |
arr[i][j] = {id: this.increment++, amount: Math.random()} | |
} | |
} | |
return arr; | |
} | |
} | |
Table.init(3, 3); | |
console.log(Table.matrix); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment