Now let’s add the ability for the user to purchase new producers.
If you’ve created producers with single digit ids, you did everything right. If not, you can still fix it.

In this task you should only modify the handleKeyPress function.

If user presses the key that corresponds to the id of a producer and they have enough gold to by it, then
we should:

  • Deduct the cost of the producer from the gold balance
  • Increase the cost of the next producer by multiplying the current cost by the growthRate
  • Increment the count of the producer that was purchased

This task is part of the Full-Stack JavaScript Course.
If you have any issues with it, you can ask for community help below the post.
Feel free to help others if you’ve already solved the task.