When he did good he was good and presumably when he didn't do so well he believed he was bad. This is called conditional self acceptance, the belief that personal worth is tethered to how others esteem us or how well we do at things. Jack could be a victim of Severe Approval Dependence (SAD) and experience life as a series of highs and lows according to how others view him or how well or badly he performs at tasks. We will not as humans always succeed at doing well at tasks and we will inevitably at times fall short of our goals. We may not win the respect and affection of significant others on lifes journey either. What we can do is cutivate unconditional self acceptance in ourselves and teach our children that they can make mistakes but that does not make them mistakes ('I can fail but I'm never a failure'). We can also learn to believe that though we may desire the approval of others we don't need it. We can learn to approve of ourselves ('I can be rejected/criticised by others but I'm never a reject myself') thereby lessening the hurt we may experience when things go awry.
Jack worked hard and practiced taking healthy risks and discovered in time that when he didn't quite achieve what he wanted to achieve or others weren't as approving or courteous towards him as perhaps they could be that the world didn't end. He developed the view that no matter what he was always worthwhile, unconditionally because he existed and that was that!
But I am always OK!'