JSFiddle - React, Tailwind, and code Playground

HTML

<div id="data"></div>

JavaScript

$(document).ready(function () {
    var s1 = "http://www.site.com/example/index.html";
    var s2 = s1.replace(s1.split("/").pop(),"");
    
    $('#data').html(s2);
});