var Book = (function (){ var cost = 1000 ,tax = 0.05 ,price = function () { return cost * (tax + 1) }; return { getPrice : function () { return price();//cost * (1 + tax); } ,getTax : function () { return cost * tax; } }; })(); console.log(Book.getPrice());//1050 console.log(Book.getTax());//50 console.log(Book.price());//error Bookはstaticな関数を持ったクラスのように使えます。 getPrice, getTaxはstatic public function
