What is the difference between JavaScript and Java?

The primary difference between Java and JavaScript is that Java is a programming language, whereas JavaScript is a scripting language. In fact, the two are not related as all. JavaScript is only named as use because the term Java was quite popular at the time.

Java

JavaScript

Java is an OOP programming language

Java Script is an OOP scripting language.

Developed by Sun Microsystems, not part of Oracle

Developed by Netscape

Creates applications that run in a virtual machine or browser

Run on a browser only

Create individual programs and applications

Makes dynamic webpages

Writes code for stand-alone applications.

Does not create applets or stand-alone applications.

Write independent code

Embedded into HTML code

Code needs to be compiled

Code is in text

Statically typed language

Dynamic language

Class-based

Prototype-based

Constructors are special functions that can only be called at object creation

Constructors are standard functions

Requires all non-block statements to end with a semicolon

Inserts semicolons at the ends of certain lines

Uses block-based scoping

Uses function-based scoping

Has an implicit this scope for non-static methods, and implicit class scope

Has implicit global scope

Add new comment

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.