In the following:
const s1 = "HEllo Rick, it's Tom calling."
const r1 = /\b(?<capital>[A-Z])([a-z])/g;
let rp = s1.replace(r1, ({obj}) => console.log(obj));
How would I get all the args from String.replace
into a single object here?
In the following:
const s1 = "HEllo Rick, it's Tom calling."
const r1 = /\b(?<capital>[A-Z])([a-z])/g;
let rp = s1.replace(r1, ({obj}) => console.log(obj));
How would I get all the args from String.replace
into a single object here?
The syntax would be:
const s1 = "HEllo Rick, it's Tom calling."
const r1 = /\b(?<capital>[A-Z])([a-z])/g;
let rp = s1.replace(r1, (...obj) => console.log(obj));