Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Free Nodelet Hack: Collapse/expand Nodelets individually (JS hashes)

by ikegami (Patriarch)
on Feb 05, 2007 at 17:52 UTC ( [id://598367]=note: print w/replies, xml ) Need Help??


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); }
  • Comment on Re: Free Nodelet Hack: Collapse/expand Nodelets individually (JS hashes)
  • Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://598367]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2024-04-24 00:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found