Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save andreiskandar/231826462ee61e1d114581d505c687d5 to your computer and use it in GitHub Desktop.
Save andreiskandar/231826462ee61e1d114581d505c687d5 to your computer and use it in GitHub Desktop.
Multiplication Table
/*
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