A particular object is being utilized (referred to as an "associate array" or a plain JavaScript object):
obj = {}
obj["Foo"] = "Bar"
obj["bar"] = "Foo"
The goal is to loop through obj
using CoffeeScript in the following manner:
# CS
for elem in obj
However, the resulting JS code is shown below:
// JS
for (i = 0, len = obj.length; i < len; i++)
This translation may not be suitable for this scenario.
In JavaScript, one would typically use for(var key in obj)
, so the question arises: How can this be achieved in CoffeeScript?