Created
July 1, 2020 04:59
-
-
Save andreiskandar/231826462ee61e1d114581d505c687d5 to your computer and use it in GitHub Desktop.
Multiplication Table
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
/* | |
Create a function named multiplicationTable that receives a number maxValue as input | |
and creates a square multiplication table where maxValue is the largest value in the table. | |
*/ | |
const multiplicationTable = function(maxValue) { | |
let i = ''; | |
for(let y = 1; y <= maxValue; y++){ | |
for(let x = 1; x <= maxValue; x++){ | |
i += y * x + ' '; | |
} | |
i += '\n'; | |
} | |
return i; | |
}; | |
console.log(multiplicationTable(5)); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment