可能重複:
What is the best way to get the minimum or maximum value from an Array of numbers?閃光AS3()函數
嗨 - 我試圖使用閃光燈的Math.max()功能找到一組數字中最高的一個。通常,這些是通過逗號分隔的數字字符串輸入的,但我需要通過數組中的一系列數字循環。這是什麼適當的語法?我試過了:
var maxMemberWidth = int(Math.max(
for (var k=0;k<memberClips.length;k++){
memberClips[i].memeberWidth;
}
));
但這顯然是不正確的。我有一種感覺,答案涉及運行某種單獨的函數並將值返回給此函數,但我還沒有完全明白語法。
謝謝 - 我其實只是找到了一個不錯的方法,在這裏:http://stackoverflow.com/questions/424800/what-is-the-best-way-to-get-the-minimum-or-最大值從 - 一個陣列-的號碼 – mheavers 2011-05-05 19:21:54