replace, replaceAll, split and join
replace changes the first match, replaceAll all of them. split turns a string into an array and join turns an array into a string.
Example
const s = "a-b-c";
console.log(s.replace("-", "+"), s.replaceAll("-", "+"));
console.log(s.split("-"), ["x", "y"].join(" & "));Exercise
Replace every match.
s.("a", "b")
Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.