Array is not adding correctly

I have a student whose code looks fine to me. The problem is the array keeps adding incorrectly. It doubles the numbers after the first item entered. Any ideas?

Tip Calculator


Out of an abundance of caution on the last day before the create task is due, we are not answering debugging questions that are not directly related to the curriculum. I would be happy to help tomorrow if you are still having issues. If so, please respond using the format of the debugging threads so that we have a little more information to help guide you:

  • Link to the project or level:
  • What I expect to happen:
  • What actually happens:
  • What I’ve tried:

Until then, here are some general debugging guidelines to help pinpoint the issue:

  • Use console.log statements to see the values of the variables and narrow down where the problem may be occurring.
  • Use the debugger - breakpoints and watchers to debug the issue you are facing
  • What line is causing this behavior? Can you remove/comment outlines to remove the error?
  • How is this project similar to others students have written? Can they use any of them as a template?

Please reach out after the due date if you still need help.