projects
/
fizzbuzz.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
b2c80c6
)
JavaScript版を無名ファンクションを使った記述に変更
author
j8takagi
<j8takagi@nifty.com>
Tue, 30 Oct 2012 03:26:29 +0000
(12:26 +0900)
committer
j8takagi
<j8takagi@nifty.com>
Tue, 30 Oct 2012 03:26:29 +0000
(12:26 +0900)
javascript/fizzbuzz.js
patch
|
blob
|
history
diff --git
a/javascript/fizzbuzz.js
b/javascript/fizzbuzz.js
index
d4971b0
..
3a6fbe4
100644
(file)
--- a/
javascript/fizzbuzz.js
+++ b/
javascript/fizzbuzz.js
@@
-1,10
+1,3
@@
-min = 1;
-max = 100;
-
-for(i = min; i <= max; i++) {
- fizzbuzz_puts(i);
-}
-
function fizzbuzz_puts(n) {
fizz = (n % 3 == 0);
buzz = (n % 5 == 0);
@@
-18,3
+11,12
@@
function fizzbuzz_puts(n) {
document.write(n, "<br />\n");
}
}
+
+(function () {
+ var min = 1;
+ var max = 100;
+
+ for(i = min; i <= max; i++) {
+ fizzbuzz_puts(i);
+ }
+})()