Skip to content

Instantly share code, notes, and snippets.

@itochan
Last active August 29, 2015 14:23
Show Gist options
  • Save itochan/5b01cea6671fcfe6f217 to your computer and use it in GitHub Desktop.
Save itochan/5b01cea6671fcfe6f217 to your computer and use it in GitHub Desktop.
function nabeatsu() {
for (var i = 1; i <= 99; i++) {
if (i % 3 == 0 || i % 10 == 3 || (i > 10 && i % 30 < 10)) {
alert('アホ');
} else {
alert(i);
}
}
}
function nabeatsuEx() {
for (var i = 1; i <= 99; i++) {
if (i % 3 == 0 || i % 10 == 3 || (i > 10 && i % 30 < 10)) {
var digit = i % 10;
var ten = Math.floor(i / 10);
var text = '\';
switch(ten) {
case 1:
text += 'じゅー';
break;
case 2:
text += 'にじゅー';
break;
case 3:
text += 'さんじゅっ';
break;
case 4:
text += 'よんじゅっ';
break;
case 5:
text += 'ごじゅー';
break;
case 6:
text += 'ろくじゅっ';
break;
case 7:
text += 'ななじゅっ';
break;
case 8:
text += 'はちじゅっ';
break;
case 9:
text += 'きゅーじゅっ';
break;
}
switch(digit) {
case 1:
text += 'いっち';
break;
case 2:
text += 'にっ';
break;
case 3:
text += 'さんっ';
break;
case 4:
text += 'しっ';
break;
case 5:
text += 'ごっ';
break;
case 6:
text += 'ろっく';
break;
case 7:
text += 'しっち';
break;
case 8:
text += 'はっち';
break;
case 9:
if (ten == 0) {
text += 'きゅっ';
} else {
text += 'くっ';
}
break;
}
text += '!/';
alert (text);
} else {
alert(i);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment