JavaScript match() function g flag

The match() function is used in JavaScript for regular expression matches. It takes a regular expression as an argument and returns an array containing the matching value(s). If the g flag is set it returns all matches. Without the ‘g’ flag, it returns only the first match. This is still an array but with only [...]