"Winner's never quit and quitter's never win" - Vince LombardiDon't Quit
If you have a job, don't quit it even if you hate it. You should be looking for a new job while retaining your current job. The fact you have a job gives you an advantage over someone who's unemployed.
Learned from Hockey
Watch this video of a hockey player missing an empty net.
I coached and played hockey and there were often situations that looked hopeless. The other team would have the puck and an empty net would stare the player in the face. I found often if I or someone else gave up it was a bad decision. Often, even in what appeared to be a hopeless situation, you can still snatch victory from the jaws of defeat. I saw it happen over and over where a player would give up and if they hadn't they could have prevented a goal from being scored.
This is the same when you see a baseball player not run hard to first base. Once in a while they would have been safe had they run hard and not quit. I dislike seeing a player who does this like Robinson Cano when he was on the Yankees
Many people quit when learning a new skill. They can tell themselves hypnotic messages like:
Juggling has taught me that if you don't quit you can learn almost anything.
Know When To Quit
At the same time as I say "Don't Quit," you also have to know when to quit. In the stock market, this is called a stop loss. Instead of losing all your money in a bad investment, you set a rule that gets you out like if a stock is down 10% from my purchase price sell.
If you're working on a project and you're not getting the success you hoped for, set a deadline and then after that it's okay to quit and move onto another idea.
So don't get stuck with falling in love with an idea, person or company. Sometimes you do have to let them go so you can focus on something with better odds of success.