for loop inside foreach code example
Example: use this inside a foreach
arr.forEach(function(obj) {
this.addObject(new Obj(obj.prop1, obj.prop2));
}.bind(this));
arr.forEach(function(obj) {
this.addObject(new Obj(obj.prop1, obj.prop2));
}.bind(this));