I am learning javascript and while I was on Codewars I couldn't figure this problem out so I looked for a solution.
This is the solution I found and I just don't understand why there needs to be a second return statement inside the map method. If anyone could give me some insight it would be much appreciated. Thank you.
let spinWords = (str) => {
return str.split(' ').map(function(string) {
return (string.length > 4) ? string.split('').reverse().join('') : string
}).join(' ');
}