String.prototype.matchAllbeginnerconst str = 'a1 b2 c3'
const matches = [...str.matchAll(/(w)(d)/g)]
matches.length // β 3
matches[0][1] // β 'a'Use matchAll() with the g flag to iterate over all regex matches and access capture groups in each result.
When the pattern does not match anything, the spread array is empty.
Challenge: Implement noDigits(str) that returns true when str contains no digit sequences.
noDigits('hello') // β true
noDigits('hi5') // β false