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

141
Views
Searching for a specific array in an array of arrays
const a = [[1,1], [2,1], [3,1]];
console.log(a);
console.log(a.includes([1,1]));

> false

Can someone explain to me why the above outputs false? For what its worth, this occurs in any of the search functions (.find, .indexof, etc), as well as if I try [1,1] in a. I'm clearly missing something about how multidimensional array searching works in javascript.

about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

This is basically how equal to operator works in JavaScript. If we try to compare two arrays

[1]=== [1] // false equality operator can compare primitive values(number,string Boolean). But in case of arrays and objects it compares for reference. So here we are comparing two different references so it is coming as false. For same reason you are getting false. You have to write customer logic to compare arrays.

about 4 years ago · Santiago Trujillo Report
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!