Get object from array by max property

后端 未结 3 637
被撕碎了的回忆
被撕碎了的回忆 2020-12-12 03:03

I need to perform in JavaScript what in C# would look like this:

var latest = versions.OrderByDescending( v => v.VersionNo).First();

I w

3条回答
  •  萌比男神i
    2020-12-12 03:28

    There are many answers to this. Since you didn't specify I can show yo multiple options:

    1. Jquery.grep
    2. .Map
    3. Math.Max

提交回复
热议问题