Skip to content

Instantly share code, notes, and snippets.

@mrm8488
Created January 3, 2020 21:49
Show Gist options
  • Save mrm8488/e7b95734388c989ee32816d812e713d5 to your computer and use it in GitHub Desktop.
Save mrm8488/e7b95734388c989ee32816d812e713d5 to your computer and use it in GitHub Desktop.
Create a vector and a matrix in JS
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