You stick $10k in the market when shares are $10 each. This means you get 1000 shares. Then the market crashes and now those 1000 shares are worth $5k. Normally this would be fine; you know the market will rebound eventually. Then you lose your job and have no cash on hand.
You're out of the job for a few months, and you slowly sell your shares until you find a new job. Say it takes $4k to keep you afloat for a few months. You now have $1k left in the market, 200 shares. That $4k of spending actually cost you $8k. Though the market rebounds eventually and your remaining 200 shares are worth the $2k they originally were, you're still $8k short and you always will be. That money is gone. It would've taken more than 20 years for inflation to turn $8k in cash into $4k.
In short, cash is a cheap hedge against some bad luck eating up your investments. The inflation that slowly devalues your cash is a much more acceptable risk than the one I describe. Markets can be rough in the short term. It's easy to hedge against them. Do it.