Periksa href javascript

// CHECK HREF
const navLinks = document.querySelector(".nav_link");
const navLink = navLinks.getAttribute("href");
const browserHref = window.location.href; // browserHref.search(navLink)

function sliceLink() {
   if (browserHref.includes(navLink)) {
     let searchLink = browserHref.search(navLink); // get position
     let slicedString = browserHref.slice(searchLink); // result
     return slicedString;
   }
}
inbloom