I noticed that Javascript allows you to add a name/value (or key/value) pair inside already-made regular arrays (not objects). Why is this allowed? Is there an intention behind this? Is this another data type? I understand this is neither an object nor an associative array (which is really an object). I know arrays are objects too, and in this case JS is allowing me to use a string instead of a number as a key, but this would put the data in an odd category which is neither a regular array nor an object.
array1 = ['a', 'b', 'c']
array1.propertyName = 'property value'
console.log(array1); // [ 'a', 'b', 'c', propertyName: 'property value' ]
This question was already addressed in How to create an associative array in JavaScript literal notation, but no real answer was given rather than "You need to use an object". I already use objects in JS, I am just curious about this behaviour in arrays.
Thank you!