The prep is done, so let’s start from the beginning.
Once the user has enough gold to purchase the first producer, it makes sense to change the welcome message.
I suggest creating a function checkInitCompleted that should be called from handleKeyPress once the user has enough gold to purchase the first producer.

Here’s how checkInitCompleted should work:

  • It should accept forwarded arguments term and state.
  • It should move to the beginning of the first line, erase it and print the message You can purchase producers by clicking the number button (1, 2, 3, ...)
  • It should print the messages GOLD: and PRODUCTION RATE: on lines 2 and 3 respectively.
  • It should be called from handleKeyPress if the user has enough gold to purchase first producer.

Don’t forget that the transition from the initial welcome message should happen only once.
Even though the function handleKeyPress could be called multiple time, checkInitCompleted should only be called once.

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.