Your for loop condition and increment are inverted:
for (var i=0 ; i++ ; i<splitted.length){ ...
should instead be:
for (var i = 0; i < splitted.length; i++) { ...
You also have to fix your looping code as it returns in both branches of you inner if statement, which means only a single iteration will run.
If you want to return the length of the smallest word, do this:
function findShort(s) {
let splitted = s.split(' ');
let result = splitted[0].length;
for (let i = 0; i < splitted.length; i++) {
const looped = splitted[i].length;
if (looped < result) {
result = looped;
}
}
return result;
};
console.log(findShort("bitcoin take over the world maybe who knows perhaps"));
Or shorter using Array.prototype.reduce():
function findShortest(s) {
return s.split(/\s+/).reduce((out, x) => x.length < out ? x.length : out, s.length);
};
console.log(findShortest('bitcoin take over the world maybe who knows perhaps'));