You are on page 1of 1

The main difference is that Javascript is what it is called a scripting language.

It doesn't
have to be compiled to be executed, like C++ and Java.
In C++ and Java you have to declare the type of the variable along with the variable, like
int x. In JS you just say var x be it a number, a string or anything.
This is common in scripting languages. It makes it faster to develop small scripts.
Creating enterprise apps without type-checking can get messy though.
Java Script is traditionally used to write scripts for webpages, i.e. adding dynamic
functionality to otherwise static webpages.
The client recieves the whole source of the script and the browser executes it - the
browser has a Javascript interpreter. On the other hand a browser couldn't execute a
Java or C++ program. Compiled programs are executed natively by the OS (well in the
case of Java, it doesn't compile to native machine code, it compiles to Java byte code,
which is executed by the Java Virtual Machine). This means that java script is more
flexible and.
Nowadays one can also create Java Script programs that run independently of the
browser, though (Node.js), allowing it to be used for general purpose tasks (as a web
server for example).

You might also like