matchAll Throws error when g flag is missing now? matchAll Throws error when g flag is missing now? google-chrome google-chrome

matchAll Throws error when g flag is missing now?


The information presented to you on MDN, in this instance, is wrong.

The Official ECMA Specification, ECMA-262 as of February 15, 2020( See here ), states that if there is no g flag present, that matchAll should throw a TypeError.

See specifically 2.b.iii below.


matchAll MDN


The error message is obviously fairly confusing with its phrasing, but still correct.