JSFiddle - React, Tailwind, and code Playground

by René Glasow

JavaScript

var root = "http:://test.com/test/test2/index.html";
var newRoot = root.substr(0, root.lastIndexOf("/"));
alert(newRoot);