I Really don't get it

Soo reading is not my thing at all. I tried and tried didn’t really get through it. So I moved on to the next video and that was actually sone explanation about how it works and I did come quite far but got really stuck at the counting apples part and how to make things a function. If somebody could help me that would be amazing because its really frustrating! Thank you:)
Maybe a good video instruction where it show it step for step writing it in the console.