and this is my code and why it does not work?
Your regex is removing all white-spaces, then it doesn’t make sense to split the string because there is no more white-spaces.
var numArr = numbers.replace(/\s/g, '').split(" ");
Remove the regex.
var numArr = numbers.split(" ");
1 Like