How do I replace a string in JavaScript?
I'm getting the page name.
var str = window.location.pathname;
The url name is "/checkout/9/finalizacao"
I want to change to "/checkout/"
In case the first 10 characters.
I know there is the sub string method, however I do not know how to use it.
You do not need to put a complicated code, just the function I use to get the first 10 characters and how to implement it. (I'll use it in an if after)
if (pageName == "/carrinho/index" || str == "/checkout/"){
}