-1

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?

samuelbrody1249
  • 4,379
  • 1
  • 15
  • 58

1 Answers1

-1

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));
samuelbrody1249
  • 4,379
  • 1
  • 15
  • 58