jsメモ
オブジェクトリテラル
var Test = { aaa: "cri", bbb: "maru", ccc: function(){ return this.aaa + this.bbb; } } Test.ccc(); // "crimaru"
名前空間スコープ
var init = "moge"; (function(){ var init = function(){ alert('hoge'); } init(); })(); init // "moge"
名前空間スコープ
t = "aaa"; (function(){ var Common = function(){} Common.prototype.aaa= function(){ alert("hoge"); } var t = new Common(); t.aaa(); })(); t
コンストラクタ
function Test(a, b){ this.a = a ; this.b = b ; this.c = function(){ return this.a + this.b ; } } var t = new Test('cri','maru'); console.log(t.c()); // "crimaru"
function Test(a){
this.a = a;
}
Test.PI = 2222 ;