How to sort an array of timestamps using lodash in desc order

前端 未结 7 1170
情话喂你
情话喂你 2021-01-12 22:46

I want to sort the following array of timestamps using lodash so the latest time stamp is first [3].

Code:

let timestamps = [\"2017-         


        
相关标签:
7条回答
  • 2021-01-12 23:33

    orderBy allows you to specify the sort orders while sortBy does not.

    const sorted = orderBy(timestamps, ['desc']);
    
    0 讨论(0)
提交回复
热议问题