Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Matrix {
- constructor(string) {
- this.matrix = string.split("\n").map((line) => line.split(" ").map((char) => Number(char)));
- }
- get rows() {
- return this.matrix;
- }
- get columns() {
- return this.matrix[0].map((column, index) => this.matrix.map(row => row[index]));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement