-2

const text = '/admin/paper18'

I want to convert this text, which is I need to remove second '/' and rest of it. the result has to be like this:

const text = '/admin'

What do I have to do, how can I convert it?

  • 1
    Does this answer your question? [How to grab substring before a specified character](https://stackoverflow.com/questions/9133102/how-to-grab-substring-before-a-specified-character-jquery-or-javascript) – Reyno May 25 '22 at 11:32
  • that is not my answer, because ı have a two slash I dont want to remove first, ı just only remove other one – Bayoguzhan May 25 '22 at 11:33
  • The linked answer does not really answer the question (it solves a similar problem). A solution for this question would be split, slice, join (I had an answer, but question was closed). Please reopen – ef-dknittl-frank May 25 '22 at 11:41
  • ı re open please share with me the solution ♥ – Bayoguzhan May 25 '22 at 11:50

0 Answers0