Multiplication Table
Warm up
Write a function that returns a 10 X 10 multiplication table (2D array).
For example:
multTable();
// Output:
// [
// [1,2,3,4,5...],
// [2,4,6,8,10...],
// [3,6,9,12,15...],
// ...
// ]
BONUS:
Allow for the function to take a parameter n
and return a table with n
* n
cells.
//if n === 5
multTable(n);
// Output:
// [
// [1,2,3,4,5],
// [2,4,6,8,10],
// [3,6,9,12,15],
// [4,8,12,16,20],
// [5,10,15,20,25]
// ]