Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
구구단
for (var i = 1; i <= 9; i++) {
for (var j = 1; j <= 9; j++) {
console.log(i, 'X', j, '=', i * j);
}
}
eachDan(7);
for (var i = 8; i <= 18; i += 2) eachDan(i);
printDan([3, 7, 9, 13]);
rangeDan(1, 9);
var eachDan = function(n) {
for (var i = 1; i <= 9; i++) {
console.log(n, 'X', i, '=', n * i);
}
};
var printDan = function(dan) {
for (var i = 0; i < dan.lenght; i++) {
eachDan(dan[i]);
}
};
var rangeDan = function(min, max) {
var arr = [];
for (var i = min; i <= max; i++) arr.push(i);
printDan(arr);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment