Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

94
Vistas
Array of key/value pairs?

I'm working with ethers.js and fetching data from a smart contract. When logging the response to the console, something along the lines of this gets logged:

0: BigNumber {_hex: '0x05', _isBigNumber: true}
1: "test test test"
2: "transfer(address, uint256)"
3: "data data data"
4: BigNumber {_hex: '0x01', _isBigNumber: true}
5: BigNumber {_hex: '0x61a4e4ae', _isBigNumber: true}
6: false
contractAddress: "test test test"
functionSignature: "transfer(address, uint256)"
id: BigNumber {_hex: '0x05', _isBigNumber: true}
params: "data data data"
voteAmount: BigNumber {_hex: '0x01', _isBigNumber: true}
voteFinishTimestamp: BigNumber {_hex: '0x61a4e4ae', _isBigNumber: true}
voteFinished: false

So it looks like the data is logged twice, once with the indices and then once more as key/value pairs. I'm extremely confused as to how this works. When Array.isArray() is called on this data structure, it returns true, yet it allows accessing the properties both through indices and through dot notation. So, data[6] will return the same thing as data.voteFinished. I don't understand what this array/object hybird is and how it's possible to access array properties through dot notation in this specific scenario. Any clarification would be great.

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda