You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In lololodash there is a bug in the 5th lesson. The following correct solution is not accepted:
// include the Lo-Dash libraryvar_=require("lodash");varworker=function(items){return_(items).groupBy('username').map(function(comments,username){return{username: username,comment_count: comments.length};}).sortBy(function(item){returnitem.comment_count*-1;}).value();};// export the worker function as a nodejs modulemodule.exports=worker;
The reason for this is that it expects the results to be sorted by comment_count, username, instead of just comment_count. So the following solution does work:
// include the Lo-Dash libraryvar_=require("lodash");varworker=function(items){return_(items).groupBy('username').map(function(comments,username){return{username: username,comment_count: comments.length};}).sortBy('username').sortBy(function(item){returnitem.comment_count*-1;}).value();};// export the worker function as a nodejs modulemodule.exports=worker;
The text was updated successfully, but these errors were encountered:
Thank you for that - you don't have to sort them by username. But you code make a different order to the last elements with the same count. I updated the exercise - so your first function would pass.
Just update lololodash with $> sudo npm install lololodash -g
In
lololodash
there is a bug in the 5th lesson. The following correct solution is not accepted:The reason for this is that it expects the results to be sorted by
comment_count
,username
, instead of justcomment_count
. So the following solution does work:The text was updated successfully, but these errors were encountered: