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

183
Vistas
Are we unable to use HTML element literals as hash table keys in JavaScript?

I figured every new instance of an HTML element would be it's own distinct object, but hash tables are telling me differently. If I do: document.createElement("button") === document.createElement("button") I get the expected result of false , but if I do:

let hash = {
    [document.createElement("button")]: "choice 1",
    [document.createElement("button")]: "choice 2"
}

console.log(hash);

then the result is: {[object HTMLButtonElement]: 'choice 2'}, meaning the second button element overwrote the first button element even though they're supposedly different values. Does anyone know why that is? Can we not use elements as distinct keys in a hash table? If so, is there an alternate way of achieving what I have above?

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