as per the Regexp.prototype.exec documentation the first index of the result is the whole match and then each next index is the corresponding group so in your case match[4] will be w/e the 4th group matched.
For example:
var match = new RegExp(
"aaaa(ab+) something ([^ ])+ here is a (third) and a (forth match .+) end."
).exec("aaaaaaabbbbb something else here is a third and a forth match with something until the end.");
console.log(JSON.stringify(match, null, " "));`
will print
[
"aaaaabbbbb something else here is a third and a forth match with something until the end.",
"abbbbb",
"e",
"third",
"forth match with something until the"
]
The last few questions are generic javascript questions, so just using google and maybe asking them in places with javascript developers will be enough, no need to ping me to answer a non k6 centric question