newの挙動
眠いので低調。
(function(){})() の代わりに - IT戦記
へー。
newが正確には何をするか考えたことなかったけど、
new function() { //どうのこうの }
は、
(function(){ this={} //どうのこうの return this })();
みたいなことしてるんだろうか。そう考えると納得がいく。
仕様の11.2.2 new 演算子 (The new Operator)および13.2.2 [ [Construct] ]あたりにもそれっぽいことがかいてあった。