From 961b8e372fa16d9d48cef21b8d0d51cba6865eb3 Mon Sep 17 00:00:00 2001 From: TAKANO Mitsuhiro Date: Wed, 28 Mar 2012 16:47:51 +0900 Subject: [PATCH] first commit --- README.rst | 6 ++++++ fb.js | 20 ++++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 README.rst create mode 100644 fb.js diff --git a/README.rst b/README.rst new file mode 100644 index 0000000..554f115 --- /dev/null +++ b/README.rst @@ -0,0 +1,6 @@ +==================== +Fizz Buzz in Node.js +==================== + + + diff --git a/fb.js b/fb.js new file mode 100644 index 0000000..1c5dcec --- /dev/null +++ b/fb.js @@ -0,0 +1,20 @@ + +f = "Fizz"; +b = "Buzz"; + +function fb(n) { + if (n == 0) return; + fb(n - 1); + if (n % 15 == 0) { + console.log(f + b); + } else if (n % 5 == 0) { + console.log(b); + } else if (n % 3 == 0) { + console.log(f); + } else { + console.log(n); + } +} + +fb(100); +