0

Why do javascript arrays allow me to use a string as a key index?

For example,

let r = [];
r['test'] = 'testvalue' // [testvalue: 321]

Arrays can be used like objects. Is that because everything in Javascript is an object, is that why arrays have that object-like functionality?

jhaubrich.com
  • 79
  • 2
  • 10

0 Answers0