The RegExp.exec function returns something that looks like a hybrid array. It's an array, but it has properties.
console.log(/d(b+)(d)/i.exec("cdbBdbsbz"));
// => ["dbBd", "bB", "d", index: 1, input: "cdbBdbsbz"]
I can call result[0], result[1], result.index, result.input, etc.
How do I make my own?
[0, 1, "a": 1] is obviously a syntax error, and {"0": 1, "1": 1, "a": 1} does give me an object I can index and access properties of, however it's not the same as what's returned by exec.
I tried doing it with __proto__:
arr = [1, 2, 3];
arr.__proto__.a = 1 // arr.a is 1 now
But console.log doesn't display the property like it does when run on the result of exec, so I suspect it's still not the same thing.