100 JS Functions

Beginner

1. CurrentYear

2. SimpleCounter

3. DoubleNumber

4. CreateColor

5. DynamicGrid

6. DynamicPictureSize

7. RandomButton

8. TabbedNavigation

9. MathOperator

10. GuessTheNumber

11. BetweenDates

12. Reactions

13. FeedTheBunny

14. Countdown

15. ClickFast

16. SkillsForJobs

17. UsersTabel

18. TodoList

19. UserSearch

20. SpendingInfo

14.Countdown

Write a React component named Countdown that renders a Start button along with an initial 30-second timer.

When the user presses Start:

  • The countdown begins from 30 seconds.
  • The Start button disappears.
  • Two new buttons appear: Pause and Stop.

Button behavior:

  • Stop → Resets the timer back to 30 seconds.
  • Pause → Freezes the countdown and changes its label to Resume. Clicking Resume continues the countdown.

Example 1

Input

No input props

Demo

Open demo in new window

You'll see test results here!