ã¾ãã以ä¸ã®ãã㪠package é¢æ°ãä½ãã function package(name) { package.__hash__ = package.__hash__ || {}; if (!package.__hash__.hasOwnProperty(name)) { package.__hash__[name] = { def: function(name, value) { return this[name] = value; } } } return package.__hash__[name] } ã§ããããªæãã§ä½¿ã // ãã㯠hoge ã®åå空é with (package('hoge')) { def('var0', 1); // å¤æ°ã¯ def é¢æ°ã§å®ç¾© def('var2', 2); alert(var0); // 1 alert(var2); // 2 }
{{#tags}}- {{label}}
{{/tags}}