Structure in JavaScript coding

CaldwellYSR

Member
Im trying (again) to learn my way through JavaScript. The first time I tried I was quickly overwhelmed because I had barely learned HTML && CSS at that point. Now I feel more comfortable and want to give it another swing. In the downtime between then and now I have taken an introductory programming class at school that focused on Java programming. I picked up on it very quickly because of how strict the data types and the structure of java code is.

I know JavaScript and java are completely different but the flexibility of JavaScript is really bothering me and making it so hard to learn. So what's the best or most common way to structure JavaScript code? How can I set up classes and actionlisteners similar to Java? Is it even possible?
 

ronaldroe

Super Moderator
Staff member
I have the same problem. The only way I've been able to actually work with JS at the level I need to was to look at it as "find this, do that". From there, it was really just syntax.
 

chrishirst

Well-Known Member
Staff member
I know JavaScript and java are completely different but the flexibility of JavaScript is really bothering me and making it so hard to learn. So what's the best or most common way to structure JavaScript code? How can I set up classes and actionlisteners similar to Java? Is it even possible?

In javascript they are known as event listeners

and class constructors are similar to C++ constructors
 

leroy30

New Member
Look into jquery. Once you grasp it you'll find it really useful and save a lot of common javascript tasks, namely object selection.
 
Last edited:
Top