_.invoke()
vs. _.each()
vs. _.map()
: read http://stackoverflow.com/questions/13193959/difference-between-underscore-js-each-method-and-invoke-method
_.invoke(list, methodName, *arguments)
methodName
is string, is function belongs to objectobject.methodName(...)
. return result as_.map()
_.each(list, iteratee, [context])
iteratee
is not string (a function name).iteratee
is called for each object/item as its parameteriteratee(object)
. return no result_.map(list, iteratee, [context])
like_.each()
, applyiteratee
for each itemiteratee(object)
, but difference is that return result