It is true that both have a C-like syntax, the C language being their most immediate common ancestor language. They are both object-oriented, typically sandboxed (when used inside a browser), and are widely used in client-side Web applications. In addition, JavaScript was designed with Java’s syntax and standard library in mind.
However, the similarities end there.
- Java has static typing;
- JavaScript’s typing is dynamic (meaning a variable can hold an object of any type and cannot be restricted).
- Java is loaded from compiled bytecode; JavaScript is loaded as human-readable source code.
- Java’s objects are class-based; JavaScript’s are prototype-based.
- JavaScript also has many functional features based on the Scheme language.