Created
January 3, 2020 21:49
-
-
Save mrm8488/e7b95734388c989ee32816d812e713d5 to your computer and use it in GitHub Desktop.
Create a vector and a matrix in JS
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
const array = (size,value = 0) => Array(size).fill(value); | |
let a = array(n); | |
const matrix = (rows,cols,value = 0) => Array(rows).fill(Array(cols).fill(value)); | |
let m = matrix(r,c); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment