How to build logics in js

Hey guys I am learning JavaScript from the Angela udmey course but when she explained like for example Arrays etc I get everything like how arry works idex valus etc but when she give a problem to solve ... I try much something I also solve the problem but sometimes I can't even think like that I try so hard to do but until I see the solution I can't solved it .

That's make my confidence very down

Any suggestions guys how you tackle this situation when we guys start learning JavaScript

Thankyou so much