my original solution :
function findLongestWordLength(str) {
let strRegex = /\w+\s*/g;
let strings = str.match(strRegex);
return Math.max(...strings.map(s=>s.length));
}
The above doesn’t work, so i changed
let strings = str.match(strRegex);
into this
let strings = str.split(' ');
and i passed the test.
However, any explanation on why the original solution does not work?