Skip to content

Instantly share code, notes, and snippets.

/show_leap_year.js
Created Sep 6, 2012

Embed
What would you like to do?
毎年の日数を出力するプログラム
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
You can’t perform that action at this time.