www.mydomain.com/invite/abc123
I want the function to return “abc123”. The logic goes like this:
If there is a forward slash, then take all characters after the last forward slash.
In python, I write it like this:
if s.find('/') >= 0:
return s[s.rfind('/')+1:]
But how do I do this in javascript?
You don’t need regexp to do this.