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.
- Use a
whileloop that runs as long asstartis greater than 0. - Inside the loop, subtract 2 from
start. - Count how many times the loop successfully runs, and return that count.
Constraints
FundamentalsLoops
JavaScriptSystem handles I/O — write your function only
Loading...
3 Hidden
Input Arguments
start6
Expected Output
3
Click RUN to test your solution