Skip to content

Commit 7395f91

Browse files
7th Day
1 parent 6888771 commit 7395f91

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

30 Days JavaScript Challenge/7-Day.js

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// Define a function that takes a number parameter
2+
function multiplicationTable(number) {
3+
// Use a for loop to iterate from 1 to 10
4+
for (let i = 1; i <= 10; i++) {
5+
// Multiply the number with the current iterator and store the result in a variable
6+
let result = number * i;
7+
// Print the multiplication table for the given number
8+
console.log(`${number} x ${i} = ${result}`);
9+
}
10+
}
11+
12+
// Call the function with a test case to see the output
13+
multiplicationTable(5);

0 commit comments

Comments
 (0)