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

114
Vistas
Why I can add into Set the same arrays?

I can add into Set exactly the same arrays, but Set mustn't add elements that already exist in this Set. Set must store only unique values. But Why am I able to add these?

let s = new Set();
s.add([1]);
s.add([1]);
s.add([1]);

console.log(s);   //Set(3) {Array(1), Array(1), Array(1)}

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

The problem with the Set object in ES6 is that the equality check is based on comparing the actual reference of inserted objects. Thus, when inserting multiple Arrays with the exact same content, it treats them as non-identical as the underlying object reference differs. Same goes for other objects. Primitives on the other hand are compared based on their values.

about 4 years ago · Juan Pablo Isaza Denunciar
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