入れ子のオブジェクト 名前空間 : JavaScript

Pocket

入れ子のオブジェクトはJavaScriptで名前空間を実装するのに便利。

var FindxFine = {};
FindxFine.Custom = function() {
    this.name = 'custom';
};
FindxFine.Custom.prototype.showName = function() {
	alert(this.name);
};
var o = new FindxFine.Custom();
o.showName();

コメント

No comments yet.

コメントの投稿

改行と段落タグは自動で挿入されます。
メールアドレスは表示されません。