I have following JSON structure
myObj = {
  name: "John",
  age: 30,
  cars: [{ type: "car", year: "1998" }, { type: "van", year: "1995" }]
};
I need to get the year of the car where thepseudois = car
In pesudo code
myObj.cars.getElement(type=car).year
which should give me 1998 as the output.
Can I do this in Javascript without loops
I need to get the year of the car where the type is = car
In pesudo code
myObj.cars.getElement(type=car).year
which should give me 1998 as the output.
Can I do this in Javascript without loops
 
     
    