多國語言翻譯:

展開 | 闔起

人氣:3909
b168168tw - javaScript | 2013-04-15 | 人氣:3909

javascript取得多數組中最大值和最小值的方法

apply();可由多個數組中抓出最大值與最小值,範例如下:

var a =[10 , 20 , 30 , 40 ];
var $maxheight=Math . max . apply ( null , a ); 
var $minheight=Math . min . apply ( null , a ); //最小值

document.write($maxheight);   //輸出最大值 40
document.write($minheight);   //輸出最小值 10

教學撰寫:徐嘉裕 Neil hsu

neilthemesSimple網站設計開發:Neil網站設計工坊,徐嘉裕Neilhsu
Website CMS by:XOOPS 網站設計:Neil網站設計工坊
營業人名稱:尼爾網站設計工坊 統一編號:37586308
服務專線:0931229118網路電話:07010003568
Do NOT follow this link or you will be banned from the site!