DEV Community

Discussion on: Daily Challenge #74 - Free Pizza

Collapse
 
andre000 profile image
André Adriano

Javascript

function promo(order, price, customers) {
    return Object.keys(customers).filter(c => customers[c].filter(p => p >= price).length >= order);
}

// Test 1
promo(min_orders, min_price, customers)
// ["Jane Doe"]

// Test 2
promo(min_orders, min_price, customers)
// ["Joey Bonzo"]

// Test 3
promo(min_orders, min_price, customers)
// ["Gorou Hironaka"]