I am new at javascript and currently writing a basic file that is run in terminal. The majority of it is working. It allows the user to add credit/remove credit and check their credit. The last part is allowing them to buy a product and have that amount be removed from their overall credit.

The issue I have is, while it does show the amount has been removed when purchasing an item. When going back to the menu and checking the remaining credit afterwards it is back to it's original amount.

I have tried using the code below instead to save the credit (which it does even after checking the credit available):

```
    credit -= readlineSync.keyInSelect(products, 'What product would you like?');

```

But because the array uses a number the user inputs, it is removing that number from the overall credit instead of the actual price. So for example, if the user selects option 4, it removes 4 from the credit when in fact the Candy is £3.

Any help that can be given would be greatly appreciated, as i have spent quite a long time without finding a solution.