What does this global search print?
JavaScript
const input = "A12 B345";
const digits = /\d+/g;
const found = [...input.matchAll(digits)]
.map((match) => `${match[0]}@${match.index}`)
.join(", ");
console.log(found);
const input = "A12 B345";
const digits = /\d+/g;
const found = [...input.matchAll(digits)]
.map((match) => `${match[0]}@${match.index}`)
.join(", ");
console.log(found);