タグ

2007年6月28日のブックマーク (1件)

  • Re: new の挙動 - IT戦記

    以下のエントリへの反応です。 new function() { //どうのこうの } は、 (function(){ this={} //どうのこうの return this })(); みたいなことしてるんだろうか。 http://d.hatena.ne.jp/gnarl/20070628/1183009662 this はキーワードなので変数としては使えないのですが、使えるとするならば、ほとんどそれに近い挙動だと 思います。 一つだけ違うのは this がどういうプロトタイプを持つかということです。 new function() { arguments.callee.prototype.hoge = 'hoge'; alert(this.hoge); // hoge }; (function() { var _this = {}; arguments.callee.prototype.

    Re: new の挙動 - IT戦記