Destructured Assignment in Ruby, PHP, and JavaScript

Stupid Code Tricks:


foo, bar = [1, 2]


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


[foo, bar] = [1, 2];  // I believe this is only valid in the latest versions of Firefox.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.