memo:JSのドキュメントを読みましょう。
<html> <tile>argumentsの練習</title> <body> <div id="hoge">結果:</div> <script> var ele = document.getElementById("hoge"); //名前つける function kurikaesi(){ console.debug(arguments); var ar = Array.slice.call(arguments); ele.innerHTML += ar.join(""); console.debug("this:" + this); //=> [object Window] return arguments.callee; }; console.debug("arguments.callee:" + kurikaesi(3)(4)(5)(6)); //で、無名関数 +function(){ ele.innerHTML += Array.slice.call(arguments).join(""); return arguments.callee; }("\nで、")('+function')('って')('????'); </script> <hr> <pre> mozillaのjavascriptドキュメントを初めてちゃんと眺めた気がしますよ。 argumentsについて https://developer.mozilla.org/ja/Core_JavaScript_1.5_Reference/Functions/arguments thisについて https://developer.mozilla.org/ja/Core_JavaScript_1.5_Reference/Operators/Special_Operators/this_Operator 「this キーワードはコンテキストオブジェクト (カレントオブジェクト) を参照します。一般的に、メソッド内では this は呼び出し元オブジェクト (calling object) を参照します。 」 なので必要なときはcall/applyで明示的に呼びましょう、と。 で、あとは+functionってなに? </pre> </body> </html>
ぐだぐだ検索するより公式に行けばイイのだった。
是非ともオフラインで欲しい。wgetでもしてみようかしら。
と思ったらもう手元に持ってた。。。なんだろ。。。ちゃんと生きよう。