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

204
Vistas
Function objectContains

I need to create a function that looks inside a nested object for a specific {key:value}.

The object, key, and value will be given as a parameter. If both the key and value are in the object together I have to return true, otherwise false

function objContains = function(obj, prop, value){
    for (let key in obj) {
      if (typeof obj[key] === 'object') {
        objContains(obj[key], prop, value)
      }
      if (obj.hasOwnProperty(prop) && obj[key] === value) {
        return true
      }
    }
    return false
  }

I tried this but I can´t make it work

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