var t = \"\\some\\route\\here\"
I need \"\\some\\route\" from it.
Thank you.
As stated in @Archer's answer, you need to double up on the backslashes. I suggest using regex replace to get the string you want:
var t = "\\some\\route\\here"; t = t.replace(/\\[^\\]+$/,""); alert(t);