Ok I trying to learn javascript for my first language but I'm having trouble with the logic/structure of "programming". I know almost everything in javascrupt I can write statements/loops/arrays/objects/ect... but I can't wrap my head around how to use it or put it into action and I can't find what I looking for on the web.

So I guess my question is how do you structure a program in javascript?

does it go like:

variables go here 

functions go here

arrays go here 

ect...

I just dont get it..