Using Arrays to Swap Variables
Problem
You want to use an array to swap variables.
Solution
Use CoffeeScript’s destructuring assignment syntax:
Discussion
Destructuring assignment allows swapping two values without the use of a temporary variable.
This can be useful when traversing arrays and ensuring iteration only happens over the shortest one: