Last Updated: February 25, 2016
·
1.182K
· keithbro

Ember.js: Use of invoke() instead of forEach()

Did you know?

array.forEach(function(element) {
  element.doSomething(arg1, arg2);
});

Is equivalent to...

array.invoke('doSomething', arg1, arg2);

Much nicer :-)

http://emberjs.com/api/classes/Ember.Enumerable.html#method_invoke