Firebugのコンソールで実行 function func_or_obj () { this.arg = 1; return this; } // オブジェクト生成 var obj = new func_or_obj(); //関数として実行 var func_rtn = func_or_obj(); console.log(obj.arg); // 1 console.log(func_rtn.arg); // 1 console.log(obj); // Object { arg = 1 } console.log(func_rtn); // Window .... //関数じゃないのでエラー //var obj_rtn = obj(); ポイント function で定義された関数は new することでオブジェクトになる thisについて newした場合は、これから生成されるオブジ
![hacking_dubbyの日記](https://cdn-ak-scissors.b.st-hatena.com/image/square/06a15c64ba0ceec233d86d71001ebb29a9dcbf5d/height=288;version=1;width=512/https%3A%2F%2Fcdn.blog.st-hatena.com%2Fimages%2Ftheme%2Fog-image-1500.png)