lodash sortBy then groupBy, is order maintained?

前端 未结 3 906
Happy的楠姐
Happy的楠姐 2021-02-14 10:56

I\'m having trouble figuring out from the lodash documentation if my assumption about sorting and grouping is correct.

If I use sortBy, then use groupBy, do the arrays p

3条回答
  •  滥情空心
    2021-02-14 11:38

    Function groupBy returns object. Object doesn't save property order. Does JavaScript Guarantee Object Property Order?

    But group arrays saves order, because thay are added with push function.

提交回复
热议问题