Javascript Object, filter and returning results

I have the following code that works fine. However I don’t know how I can add additional conditions to the filter, i.e in this code although it works fine I only want it to return venues that have an active value==1; (so in this case the venue with the SKU 1007 is not returned).

In the example I have commented out a for loop that achieves the result I want but I want to use filter instead.

Many thanks.

Can anyone help with this.

<script>
db = {};
db.venueDB = [
    {
        SKU         : 1001,
        active      : 1,
        round       : 1,
        date        : "02/03/2026",
        country     : "Germany",
    },
    {
        SKU         : 1002,
        active      : 1,
        round       : 2,
        date        : "23/04/2026",
        country     : "Czechia"
    },{
        SKU         : 1003,
        round       : 3,
        active      : 2,
        date        : "05/05/2026",
        country     : "United Kingdom"
    },{
        SKU         : 1004,
        round       : 5,
        active      : 1,
        country     : "Spain",
        date        : "20/07/2026"
    },{
        SKU         : 1005,
        round       : 6,
        active      : 1,
        country     : "Sweden",
        date        : "21/07/2026"
    },{
        SKU         : 1006,
        active      : 1,
        round       : 7,
        country     : "Brazil",
        date        : "01/98/2026"
    },{
        SKU         : 1007,
        active      : 4,
        round       : 8,
        country     : "Latvia",
        date        : "08/09/2026"
    },{
        SKU         : 1008,
        round       : 9,
        active      : 1,
        country     : "Denmark",
        date        : "12/10/2026"
    }
];

db.SKU = [1002,1005,1001,1008,1007,1001,1004];
    
const venueBySku = db.venueDB.values().map((venue) => [venue.SKU, venue]);
const lookup = new Map(venueBySku);
    
const result = db.SKU.filter(sku => lookup.has(sku)).map(sku => lookup.get(sku));


    
for(n=0; n<result.length; n++){
    //if(result[n].active==1){
        document.write(n+"] "+result[n].SKU+" "+result[n].active+" "+result[n].country+"<br/>");
    //};
};
    
</script>

filter method accepts function which should return falsy value if item should not be included and truthy value, if item should be included in the new array. When executed each element of the filtered array will be passed one-by-one to the function.

Keeping that in mind, how your requirements can be met?