Java and JavaScript are two different programming languages.
It is generally believed that at that time Netscape named LiveScript as JavaScript because Java was the most popular programming language at the time, with the name "Java" contributing to the spread of the new language.
The similarities include:
Their grammar and C language are very similar;
They are object-oriented (although the way they are implemented is slightly different);
JavaScript references Java's naming conventions at design time;
The differences between them include:
JavaScript is a dynamic type language, while Java is a static type language;
JavaScript is a weak type, Java is strongly typed;
JavaScript object-oriented is based on the prototype (prototype-based) implementation, Java is based on the class (class-based);
JavaScript is a far cry from the way Java is compared. JavaScript is designed to refer to objects that do not include Java, but include languages such as self and Scheme.
Same point:
1. Memory management, both of which use GC to recycle memory. So Java is very similar to JavaScript's memory leaks.
2. The code is compiled into machine code and executed by the middleware: Java is compiled into bytecode before it is executed by the JVM, and the V8 engine uses JIT to compile JS into machine code and is executed by the engine.
3. The memory request, object (objects), and array (arrays) are referenced from the stack (stack), and its own space is applied from the heap (heap).
4. Hash processing, array and object, numeric type key value hashcode for itself, the string type key needs to calculate hashcode to find the corresponding value, so the length of the property name determines its type in the hash class container performance, there are problems in Java.
The relationship between Java and JavaScript