js 查找對象數據中某屬性的最大值


var list=[{id:1,name:'張三',score:123},{id:2,name:'李四',score:135}]

找出數組list中最好的成績

var max = Math.max.apply(Math, this.list.map(i => {return i.seq }));
結果是135
 
找出數組中list中成績最差的成績
var min= Math.min.apply(Math, this.list.map(i => {return i.seq }));
結果是123


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM