const s = "a-b-c-d"; // replace changes only the first match console.log(s.replace("-", "_")); // replaceAll changes every match console.log(s.replaceAll("-", "_"));
replace vs replaceAll