为什么这段代码返回未定义,我找不到原因
function findShort(s){
let splitted = s.split(' ');
let result = splitted[0].length ;
let looped
for (var i=0 ; i++ ; i<splitted.length){
looped = splitted[i].length;
if (looped < result) {return looped}else {return result }}
};
console.log(findShort("bitcoin take over the world maybe who knows perhaps"));
我应该得到最小字数
守着一只汪
慕桂英546537
至尊宝的传说
相关分类