In coffee script i have this little code snippet.
class Collection
construct:(@collection=[])
Now i want to access that object as if it was an array but i want to get the collection variable when i do so. In other languages i would implements an ArrayAccess of some type and code the next, current etc methods
obj= new Collection([1,2,3])
obj[0] # this should equal 1
How can i do this in javascript or coffeescript either will do