Skip to content

Instantly share code, notes, and snippets.

Created September 6, 2012 14:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save anonymous/3656758 to your computer and use it in GitHub Desktop.
Save anonymous/3656758 to your computer and use it in GitHub Desktop.
毎年の日数を出力するプログラム
function show_leap_year() {
var textarea = document.forms["form"].elements["textarea"];
textarea.value = "";
var regex = /^\d{0,2}(0[48]|[2468][048]|[13579][26])$|^([02468][048]|[13579][26])00$/;
for (var i = 1900; i <= 2010; ++i) {
textarea.value += i + "年は" + (regex.test(i) ? 366 : 365) + "日です。\n";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment