[i]Learn· Indexed collections
Using arrays to store other properties
Arrays can also be used like objects, to store related information.
const arr = [1, 2, 3];
arr.property = "value";
console.log(arr.property); // "value"
For example, when an array is the result of a match between a regular expression and a string, the array returns properties and elements that provide information about the match. An array is the return value of RegExp.prototype.exec(), String.prototype.match(), and String.prototype.split(). For information on using arrays with regular expressions, see Regular Expressions.
example 1 of 1
[>_]Terminal
Output appears here when you press Run.
$ ▌