I am trying to execute a function that should return true, however I continue to get a return of undefined
and I am not sure why.
filterVehicle(myOBJ.availableVehicleList, myOBJ.paymentType, myOBJ.selectedVehicle, myOBJ.maxLimit, myOBJ.selectedVehicleAmt, function (response, selectedCar) {
var promotableCar = processResponse(response, selectedCar);
if(promotableCar){
return true;
}
});
The response looks something like this (array of objects):
[{
make: chevy,
model: camaro
}, {
make: chevy,
model: tahoe
}, {
make: chevy,
model: suburban
}]
processResponse
then basically widdles the array down to 1 vehicle/object
When I alert(promotableCar)
it returns [object, object]
If I alert(promotableCar.make)
it returns the make of the object returned by processResponse
(e.g. chevy)
Since technically promotable car is technically available/present, using the if(promotableCar) should return true.
What am I doing wrong? I can't seem to figure it out.
Thanks in advance for any assistance.