I am trying to use extensions for an array. What should I add to the constructor. Here is the code
class List extends Array constructor: ()-> super arguments this list = new List("hello","world") alert list[0]
It doesn't seem to work.
There is no easy way to "inherit" from a prototype array. You must use composition, i.e.
class List constructor: ()-> this.array = new Array(arguments); getArray :()-> this.array list = new List("hello","world") alert list.getArray()[0]
or you will spend your time on embedded complex solutions that will fail as soon as you try to parse the array or access its length value.
more about this problem:
http://perfectionkills.com/how-ecmascript-5-still-does-not-allow-to-subclass-an-array/
I haven't used a coffee script lately, so this is just a hunch, but it could be something like:
class List extends [].prototype
can work?
: "mu is too short", , script. , SO , : "" javascript?