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

112
Vistas
How to use a pair as a key in a javascript object

Say I want to map a pair of values (1,6) that for example to something other value, say a string "something1,6", and another pair of values (2,3) to "something2,3"

I tried doing this:

m = {}
m[{x:1,y:6}] ="something1,6"
m[{x:2,y:3}] = "something2,3"
console.log(m)

but it seems to just gives me {'[object object]':"something2,3"}, so it converted the object that I want to use as key to this "[object object]" string, and this is why when I again use an object as key, it gets converted to the same string and gets updated? If so, how can I do this in Javascript without using a 2d matrix for example to replicate the behavior I want

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