Issue
For example:
let word = 'Winter4000'
const seperate = (word) => {
...
}
seperate(word) // output: Winter 4000
The word can be random and the number is always at the end.
Solution
let word = 'Winter4000'
const seperate = word.split(/([0-9]+)/).join(" ")
split it using regex pattern looking for numbers, then join it back together with a space added
Answered By – Ian
This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0