I'm having trouble with removing all characters up to and including the 3 third slash in JavaScript. This is my string:
http://blablab/test
The result should be:
test
Does anybody know the correct solution?
javascriptstring
I'm having trouble with removing all characters up to and including the 3 third slash in JavaScript. This is my string:
http://blablab/test
The result should be:
test
Does anybody know the correct solution?
Best Answer
To get the last item in a path, you can split the string on
/
and thenpop()
:To specify an individual part of a path, split on
/
and use bracket notation to access the item:Or, if you want everything after the third slash,
split()
,slice()
andjoin()
: