In CoffeeScript how do you append a value to an Array?

Dave Sag picture Dave Sag · Sep 13, 2011 · Viewed 68.1k times · Source

What is the prescribed way to append a value to an Array in CoffeeScript? I've checked the PragProg CoffeeScript book but it only discusses creating, slicing and splicing, and iterating, but not appending.

Answer

Thilo picture Thilo · Sep 13, 2011

Good old push still works.

x = []
x.push 'a'