Created
June 5, 2010 13:35
-
-
Save ajalab/426639 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
自分を返す関数+クロージャ | |
*/ | |
function maketable() { | |
var retstr = "<table><tr>"; | |
return function(s, f) { | |
if (!s) return retstr; | |
retstr += "<td>" + s + "</td>"; | |
if (f) { | |
retstr += "</tr><tr>"; | |
} | |
return arguments.callee; | |
} | |
} | |
document.getElementById("test").innerHTML = maketable() | |
("あ行")("あ")("い")("う")("え")("お",1) | |
("か行")("か")("き")("く")("け")("こ",2)() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment