const path = "a-b-c-d"; // replaceAll swaps every match; replace swaps only the first console.log(path.replaceAll("-", "/")); console.log(path.replace("-", "/"));
replace the first match or replaceAll