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));
}