let event = [
{
"vendorBidId": 58,
"participantName": "<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="b5d7c7da9bd2d0d0f5c1d0c6c19bdcdb">[email protected]</a>",
"bidAmount": 10000,
"productionRate": 10000,
"bidTime": "2021-10-21T14:55:05.957324",
"isYou": false,
"awarded": false
},
{
"vendorBidId": 57,
"participantName": "<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="8efaebfdfacee9e3efe7e2a0ede1e3">[email protected]</a>",
"bidAmount": 20000,
"productionRate": 20000,
"bidTime": "2021-10-21T14:50:24.493522",
"isYou": false,
"awarded": true
},
{
"vendorBidId": null,
"participantName": "<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="81e3f3eeaab3c1f5e4f2f5afe2eeec">[email protected]</a>",
"bidAmount": 0,
"productionRate": null,
"bidTime": null,
"isYou": false,
"awarded": false
},
{
"vendorBidId": null,
"participantName": "<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="82e0f0edaceae7fbc2f6e7f1f6ace1edef">[email protected]</a>",
"bidAmount": 0,
"productionRate": null,
"bidTime": null,
"isYou": true,
"awarded": false
}
]
I am seeking to identify the lowest bid amount with the following condition in place:
- Skip over any entries with a null value for vendorBidId.
This is my attempt at achieving this:
let minimum = event.reduce(function(prev, curr) {
if (curr.vendorBidId !== null) {
return prev.bidAmount < curr.bidAmount ? prev : curr;
}
return prev;
});
However, I encountered challenges when incorporating my specific requirement into the code.
I only wish to determine the minimum bid amount while disregarding entries where vendorBidId is null.