Can you use a 401(k) hardship loan to pay off credit card debt?

In today's economic climate, credit card debt can quickly become overwhelming, especially with high interest rates. While a 401(k) loan can be used to pay off credit card debt, it may have long-term consequences on retirement savings.