Hi I want to split a string in a specific way in javascript, like if the string is C:/users/Me/AppData/elastic/elastic 1.6. I know I can split it using the split() method and use pop() and shift() to get first and last splitted string but I want to split it like, except the last string. So the answer should be like “C:/users/Me/AppData/elastic"
I did it like this,
str.split(str.split("/").pop()).shift()
I got the out put like this,
C:/users/Me/AppData/
But I want it like this,
C:/users/Me/AppData