Before you begin investing, have a rainy day fund. This is to cover emergencies such as losing your job or needing to buy a new car in a hurry or an unexpected health care expense or an injury that prevents you from working and earning an income etc. etc.
While you might be able to put a big unexpected expense on a credit card, that credit card debt is now a whirlpool which your future savings will get sucked into. By now you know that you must try and avoid debt as much as possible.
How much should you have saved away? This is very much a case-by-case situation but most experts recommend between 6 and 12 months of your regular expenses. If your monthly expenditure is say $1500 across rent, gas, utilities, services, food, etc., then you need between $9,000 and $18,000 in your emergency fund. That can seem daunting - so start small and keep adding to it.
Trying to put money into the stock market before having an emergency fund is a bad idea. The emergency will come at the least opportune moment (Murphy's Law) and you will have to sell your stock - potentially at a loss!
If you've gotten this far that means you have gotten a handle on your spending and your debt. Plus you have an emergency fund established. Now you are ready for the (more) fun part: start investing!