- str: It is the reference string for which matches are to be found.
- Regexp: It is simply a regular expression object. The RegExp object must include the /g flag, else an TypeError is thrown.
- Return value: It is an iterator.
In the above example, we were able to find matches and also capture the internal groups as we used the matchAll() method.