JavaScript supprimer la chaîne après la dernière barre oblique ou le point

var t = "\\some\\route\\here";
t = t.substr(0, t.lastIndexOf("\\"));
alert(t);
Powerful Plover