I am trying to understand some of the differences between writing Object-Oriented Java and Object-Oriented JavaScript. I have a fair amount of experience in Java, but not much experience with Object-Oriented JavaScript. I've tried googling around some, and I keep hearing about how JavaScript is a "Prototypal" language, but I don't quite understand it still. This was probably the most helpful thread about Prototypes: How does JavaScript .prototype work?
I still don't understand exactly what it means for Javascript to be "Prototype Based", though. Some of the more specific questions I have:
- How does inheritance work in JavaScript?
- How are private and public fields declared for a JavaScript class?
- How do declaring static and instance methods differ in JavaScript?
Example code would be very helpful, but what I really need is an explanation of some of the underlying differences between these languages.