Skip to content

Instantly share code, notes, and snippets.

@icebreaker
Created May 20, 2014 15:16
Show Gist options
  • Select an option

  • Save icebreaker/28f0af5fd0f613c0abc3 to your computer and use it in GitHub Desktop.

Select an option

Save icebreaker/28f0af5fd0f613c0abc3 to your computer and use it in GitHub Desktop.
Waste or Not?
class Iterate
constructor: () ->
@items = [11, 13, 15, 3]
iterate1: () ->
for item in @items
console.log(item)
iterate2: () ->
for item in @items
console.log(item)
null
(function() {
var Iterate;
Iterate = (function() {
function Iterate() {
this.items = [11, 13, 15, 3];
}
Iterate.prototype.iterate1 = function() {
var item, _i, _len, _ref, _results;
_ref = this.items;
_results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
item = _ref[_i];
_results.push(console.log(item));
}
return _results;
};
Iterate.prototype.iterate2 = function() {
var item, _i, _len, _ref;
_ref = this.items;
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
item = _ref[_i];
console.log(item);
}
return null;
};
return Iterate;
})();
}).call(this);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment