carRenting

mail@pastecode.io avatar
unknown
javascript
9 months ago
285 B
2
Indexable
Never
function carRenting(cars, distance) {
    let result = [];

    cars.map(car => {
        if((car.fuelAmount / car.avgConsumption) * 100 >= distance) {
            result.push(car.type);
        }
    });

    return result.length === 0 ? null : result;
}

module.exports = carRenting;
Leave a Comment