I have the lines below and I am trying to remove the last directory from them, but I cannot figure it out.
Javascript
var x = path.split("/") alert(path +' = ' +x.slice(0, -1));
Expected Result
/foo/bar/ = /foo/ /bar/foo/ = /bar/ /bar/foo/moo/ = /bar/foo/
source share