For those trying to get everything after the first occurrence:
Something like "Nic K Cage"
to "K Cage"
.
You can use slice
to get everything from a certain character. In this case from the first space:
const delim = " "const name = "Nic K Cage"const result = name.split(delim).slice(1).join(delim) // prints: "K Cage"
Or if OP's string had two hyphens:
const text = "sometext-20202-03"// Option 1const opt1 = text.slice(text.indexOf('-')).slice(1) // prints: 20202-03// Option 2const opt2 = text.split('-').slice(1).join("-") // prints: 20202-03