This is silly, but I'm having hard time understanding how these two statements outputs different results.
'theyyyyy wheels on q bus'.split(' ').reduce((shortest, w) => {
return w.length < shortest.length ? shortest = w : shortest;
}) // 'q'
'theyyyyy wheels on q bus'.split(' ').reduce((shortest, w) => {
return shortest.length > w.lenght ? shortest = w : shortest;
}) // 'theyyyyy'
In the second case, you have w.lenght
which is undefined. Change to w.length
.