Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

108
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!