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

163
Views
Check if an object array value is null

How can I check if an Object Array value is null? In this case, I want to check if the price value is null

for example

available_cars:{
cars:[
{name:"BMW", price:2000000}
{name:"Volkswagen", price:1500000}
{name:"Audi", price:null}
]
}
about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

Use Array.some and compare it to null:

available_cars = {
  cars: [{
    name: "BMW",
    price: 2000000
  }, {
    name: "Volkswagen",
    price: 1500000
  }, {
    name: "Audi",
    price: null
  }]
}

const res = available_cars.cars.some(e => e.price === null)
console.log(res)

about 4 years ago · Juan Pablo Isaza Report

0

available_cars = {
  cars: [{
    name: "BMW",
    price: 2000000
  }, {
    name: "Volkswagen",
    price: 1500000
  }, {
    name: "Audi",
    price: null
  }]
}

const res = available_cars.cars.forEach(car => {

   if(!car.price){
// handle case
    }

});
console.log(res)
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!