instrrev using jscript

I need to achieve the following piece of vbscript using jscript,
sMapPath = Server.MapPath("\")
sMapPath = Mid(sMapPath, 1, InStrRev(sMapPath,"\")-1) & "\db\mydb.mdb;"

So I basically need jscript equivilants of Mid and InStrRev
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

naveenkohliConnect With a Mentor Commented:
Mid <--> substr
InStrRev <--> lastIndexOf

I think following snippet should work.. I haven't tried it.

var sMapPath = Server.MapPath("\");
sMapPath = sMapPath.substr(0, sMapPath.lastIndexOf("\")-1);
sMapPath = sMapPath + "\db\mydb.mdb;";
awestropeAuthor Commented:
Close, helped me get there anyway!
sMapPath = Server.MapPath("\\");
sMapPath = sMapPath.substr(0, sMapPath.lastIndexOf("\\"));
sMapPath = sMapPath + "\\db\\mydb.mdb;";
All Courses

From novice to tech pro — start learning today.