Earlier quoted context omitted.
CS also saves keystrokes and makes code more readable by offering things such as: Reducing boilerplate for loop code: CS: for el, index in arr el.doThing(index) JS: for(var index=0; index Better iteration over objects: CS: for own k, v of obj console.log "#{k} is #{v}" JS: for(k in obj) { if(!obj.hasOwnProperty(k)) continue; console.log(k + " is " + obj[k]); } Default function params: CS: foobar = (foo = "default", b…
For kicks, here's Dart versions of those: Reducing boilerplate for loop code: var index = 0; for (var el in arr) { el.doThing(index++); } Dart hasn't really optimizing for iterating over a collection with indices since we don't find that very common in real-world code. Better iteration over objects: obj.forEach((k, v) => print("$k is $v")); Here, obj is a map data structure, not a random object since Dart distinguish…
a = [1,2,3];
a.prop = "oops";
for(el in a)
console.log(el);
// > 0
// > 1
// > 2
// > oops