Skip to content

Commit 7b30787

Browse files
authored
Merge pull request #1 from taichihub/01-my-fizzbuzz
20240905 FizzBuzz問題
2 parents feafcdb + a522b15 commit 7b30787

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

01.fizzbuzz/fizzbuzz.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/usr/bin/env node
2+
3+
for (let i = 1; i <= 20; i++) {
4+
let output = "";
5+
if (i % 3 === 0) {
6+
output += "Fizz";
7+
}
8+
if (i % 5 === 0) {
9+
output += "Buzz";
10+
}
11+
if (output === "") {
12+
output = i.toString();
13+
}
14+
console.log(output);
15+
}

0 commit comments

Comments
 (0)