Step by a Chosen Amount

Write the code, see it run, pass the checks.

The problem

  • easy
  • Code

Show a line reading "Total: 0", a number input labelled "Step" that starts at 1, and "Add" and "Subtract" buttons that add the step to the total or take it away. The total may go below 0. While Step is empty, both buttons are disabled. Remember that an input's value is text: adding a step of 5 to 0 must give "Total: 5", not "Total: 05".

Your code must pass

  • Add and Subtract use a step of 1 at first
  • Changing Step changes how much they add
  • The total can go below 0
  • An empty Step disables both buttons