I love deleting code. It can feel as good as coding some big new feature. There's something magical about realising you no longer need some function and indifferently throwing it away.
You might initially think any code deleted is wasted effort. But deleting is a sign that you've learned from your earlier attempts. You can now accomplish what you wanted to do before with less. It's an exercise in simplicity and minimalism.
As with writing, sometimes less is more. If you can convey your message with fewer words it's usually better. Simplifying code and deleting what's no longer needed accomplishes the same. If you can accomplish the same task with simpler code then it's usually better as well.
Yet "simpler" doesn't just mean less. It's more about refining your logic into it's most basic form to accomplish your goals. When you find that basic form it's enlightening. What you did previously looks bloated and unnecessary. It worked, but it didn't work this well.
You also have to be wary of the temptations of simplicity. Sometimes bloat is necessary. Sometimes simple and elegant code isn't practical at the moment. Like writing, there's an editing process that can come later. The aim at first is to get the words out.
But when you do find a way to simplify. Delete the old shit, you'll feel great.