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

161
Vistas
accessing whether a value is inside an Object or not

how can i know if a value is in my object in Js, I don't know how to explain it exactly but I hope the code simplifies it for you

let object = {
  1: hey
  2: hi
  3: hello
}
let exist = object.value("hello")
console.log(exist) //should print true
about 4 years ago · Juan Pablo Isaza
3 Respuestas
Responde la pregunta

0

let object = {
  1: "hey",
  2: "hi",
  3: "hello"
}
let exist = Object.values(object).includes("hello")
console.log(exist)

about 4 years ago · Juan Pablo Isaza Denunciar

0

There are plenty of ways to check if a value is contained within an object.

A simple one is by accessing the Object.values(myObject).

Should look like this:

console.log(Object.values(myObject).some(elem => (elem === ('hello'))));
// true
about 4 years ago · Juan Pablo Isaza Denunciar

0

You can use Object.values

let object = {
  1: "hey",
  2: "hi",
  3: "hello"
}
   
let exists = Object.values(object).includes("hello");
console.log(exists);
exists = Object.values(object).includes("world");
console.log(exists);

But if you need checks like this quite often, you should probably think about a data structure better supporting that scenario ...

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