Skip to content

Latest commit

 

History

History
17 lines (12 loc) · 618 Bytes

Will you make it.md

File metadata and controls

17 lines (12 loc) · 618 Bytes

Description:

You were camping with your friends far away from home, but when it's time to go back, you realize that your fuel is running out and the nearest pump is 50 miles away! You know that on average, your car runs on about 25 miles per gallon. There are 2 gallons left.

Considering these factors, write a function that tells you if it is possible to get to the pump or not.

Function should return true if it is possible and false if not.

Solution:

const zeroFuel = (distanceToPump, mpg, fuelLeft) => {
  if (distanceToPump > mpg * fuelLeft)
    return false;
  else return true;
};