I was playing around with regex in JS today and came across a data structure I've never seen before: an array where some of the entries have keys. A method which returns such a data structure is the regex match function. Here's an example:
var re = /SESSID=\w+=;/;
var test = 'SESSID=aaaa=;fjsdfjd';
var arr = test.match(re);
console.log(arr); // ["SESSID=aaaa=;", index: 0, input: "SESSID=aaaa=;fjsdfjd"]
console.log(arr[0]); // SESSID=aaaa=;
console.log(arr['index']); // 0
console.log(arr['input']); // SESSID=aaaa=;fjsdfjd
What's going on here?