JavaScript - 基礎面函數 - 找到最短 | 最長的數
返回的是: 這個字符串的長度
弊端: 只能判斷 `Number` 類型
// 找到最短的數
function findShort(s){
return Math.min.apply(null, s.split(' ').map(w => w.length));
}
// 找到最長的數
function findShort(s){
return Math.max.apply(null, s.split(' ').map(w => w.length));
}