Investing in the stock market can be an excellent way to build wealth over the long term, but it can…