Being a programmer isn't easy, if everything were easy we'd never know when we achieved what we're striving for! Similar to hours of debugging code, feeling that imposter syndrome...wondering if this is for you. Think about when you achieve it, and how it gives you the motivation to keep going.
Think about when you first started. For example, some simple html and css tutorials. Easy right? After completing numerous tutorials, I was at the stage where I felt I was making progress. Until I ran into challenges, where the tutorials I feel I mastered didn't help me. Suddenly, I thought I wasn't ready or I didn't know as much as I thought. You can start to question your motivation and confidence. It's perfectly normal to feel like this; an onset of discouragement can start to cloud your focus.
The Come Up.
Things in life aren't easy, think about where you are and how you got here. With motivation, persistence, and determination to name a few. It's all about pushing through! Don't lose your motivation because you feel you haven't yet grasped a concept, and someone else has or made it easy to do so.
Programmers with 20+ years of experience, still run into the same issues junior developers do. Remember, don't correlate yourself to others, understand and remind yourself why you're doing this, and break down problems. Take breaks, exercise, eat well, and don't forget there's no such thing as can't, because you can!