The Countdown Tracker

Easy+15 XP

Mission Briefing

The ship's fuel tank has a slow leak! You need to calculate exactly how many times the emergency pump can cycle before the fuel drops to zero.

The Concept: While Loops

A while loop is best when you don't know exactly how many times to loop, but you know the condition that should keep it running. It basically says: "While this is true, keep going."

The Objective

Your function receives a start number.

  1. Use a while loop that runs as long as start is greater than 0.
  2. Inside the loop, subtract 2 from start.
  3. Count how many times the loop successfully runs, and return that count.

Constraints

    FundamentalsLoops
    JavaScript
    Loading...
    3 Hidden

    Input Arguments

    start6

    Expected Output

    3

    Click RUN to test your solution