Answer the question
In order to leave comments, you need to log in
How to iterate over an object in coffeescript?
There is an object
moscow =
"cao": 4500
"yua": 4500
"yuvao": 4500
"vao": 4500
"svao": 3800
"sao": 3500
"szao": 3800
"zao": 4500
"yuzao": 4500
for key in moscow
if key == currentRegion
alert "Совпадение"
results = [];
for (i = 0, len = moscow.length; i < len; i++) {
key = moscow[i];
if (key === currentRegion) {
results.push(alert("Совпадение"));
} else {
results.push(void 0);
}
}
return results;
Answer the question
In order to leave comments, you need to log in
Thank you all very much, I figured it out myself.
In short, this is how it works
for key of moscow
if key == currentRegion
alert "Совпадение"
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question