ArtLung

Destructured Assignment in Ruby, PHP, and JavaScript 2007 Feb 21

Stupid Code Tricks:

Ruby http://www.ruby-doc.org/docs/ruby-doc-bundle/Manual/man-1.4/syntax.html#assign

foo, bar = [1, 2]

PHP http://www.php.net/manual/en/function.list.php

list($foo, $bar) = array(1, 2);

JavaScript http://developer.mozilla.org/en/docs/New_in_JavaScript_1.7#Destructuring_assignment

[foo, bar] = [1, 2];  // I believe this is only valid in the latest versions of Firefox.
Joe Crawford blogged this at 8:20pm in 2007 in February. The 21st was a Wednesday. You are reading this 12 years later. Make a public comment. There are no comments Tweet. Direct message. Send email. It has hashtags→ .

Leave a Reply

Comments Open; Trackbacks Open.