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

168
Views
acceder si un valor está dentro de un objeto o no

como puedo saber si un valor esta en mi objeto en Js, no se como explicarlo exactamente pero espero que el codigo te lo simplifique

 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 answers
Answer question

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 Report

0

Hay muchas formas de verificar si un valor está contenido dentro de un objeto.

Una simple es accediendo a Object.values (myObject).

Debería verse así:

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

0

Puedes usar 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);

Pero si necesita comprobaciones como esta con bastante frecuencia, probablemente debería pensar en una estructura de datos que respalde mejor ese escenario...

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