http://qs321.pair.com?node_id=598367


in reply to Free Nodelet Hack: Collapse/expand Nodelets individually
in thread Free Nodelet freed

That could've been more 'elegant'... but it's a hack. If JavaScript had hashes...

But it does! JavaScript calls them Objects. (Kinda like how objects are usually implemented as hashes in Perl).

// Hash creation and initialization var hash = new Object; var hash = {}; var hash = { foo: "Foo!", bar: "Bar!" }; var hash = { "spaced out": "ok" }; // Setting hash.foo = "Foo!"; // Static key hash["bar"] = "Bar!"; // Dynamic key // Getting alert("hash.foo: " + hash["foo"]); // Dynamic key alert("hash.bar: " + hash.bar); // Static key // Iterating for (var key in hash) { var val = hash[key]; alert("hash." + key + ": " + val); }