arrayscoffeescriptsparse-array

Declare sparse array in coffeescript


In Javascript I can declare a sparse array like:

a = [, 1]

But that gives an error in Coffeescript. So how can I create sparse arrays in Coffeescript?

I want to do it in a single assignment and not like:

a = []
a[1] = 1

Solution

  • Probably not possible.
    But you can always embed javascript:

    `a = [, 1]`