

Difference between JavaScript and Java? - redxblood

The first thing people do when they are learning is think that these two languages are very correlated because of the Java prefix. 
But, i&#x27;ve heard they are not?
I know Java, and i&#x27;m learning Javascript, and so far they are very similar at a glance...<p>So, what are the similarities and differences between them? Why the similar name?
And if anyone can give me an easy definition of script that would be cool..
======
chewxy
The language is actually called ECMAScript. It's in its 5th version right now.
As its name suggests, it is standardized by ECMA.

JavaScript is a name that is licensed to Mozilla by Sun Microsystems.
Technically speaking, only Mozilla can use the name "JavaScript". The
Microsoft version used to be called JScript. The Adobe version is called
ActionScript (ActionScript eventually turned out to be its own sorta language
that vaguely conforms to ES standards).

Because ECMAScript is just a specification, it is up to the implementors to
conform or not to the spec. Mozilla itself does a lot of weird stuff that
doesn't actually conform to the spec. But for the main uses, all three major
engines(V8, Spidermonkey and Chakra) are all pretty okay.

If you learn JS for use in node.js, then you are mainly learning the quirks of
V8's implementation (of which thankfully are minimal). You may think that
V8/Chrome is the dominant JS engine out there, but there are some softwares
like CouchDB which uses SpiderMonkey as its engine.

In the past, I believe there used to be a mini language out of Java, also
called Java Script, but that quickly fell out of use.

JavaScript as a language was designed to look similar to Java, to catch on the
Java-is-the-best-thing-since-sliced-bread bandwagon in the early 1990s. Of
course, when you mix paradigms, you have weird shit like ASI in JavaScript.

source: I am writing a couple of books about JavaScript.

------
lsiebert
They are utterly different.

This is a topic that is well documented. You can check the wikipedia pages for
both Java and javascript.

Alternatively check this
[http://stackoverflow.com/a/245069](http://stackoverflow.com/a/245069)

------
CyberFonic
The 'Java' part was due to marketing push on the part of Netscape. At the time
Java was already well established and 'LiveScript" didn't quite have the same
recognition. What's more, originally Brendan Eich modeled this new language on
the concepts in Self and Lisp. But again, the marketing PHB's forced him to
adopt a curly bracket notation like that of C, C++ and Java.

Furthermore, Java is a compiled language, whilst JavaScript is an interpreted
language (with lots of JIT tricks in some implementations, e.g. V8).

Once you start digging deeper you'll notice that other than the superficial
similarity due to the curly bracket, C-derived syntax, they are extremely
different languages. Even the "class based" and "prototype based" core
paradigms are very different. Of course, with Java being first, a lot of folks
are trying to force JavaScript to be like Java, e.g. writing code with classes
- which is a kludge at the best of time.

------
gumballhead
Compiled vs interpreted, strongly typed vs dynamically typed, object-oriented
vs functional, to name a few.

------
auslegung
In addition to what Isiebert said, if you're a book person, read javascript,
the good parts [http://www.amazon.com/JavaScript-Good-Parts-Douglas-
Crockfor...](http://www.amazon.com/JavaScript-Good-Parts-Douglas-
Crockford/dp/0596517742).

~~~
kachhalimbu
or if you prefer watching instead of reading, watch Douglas Crocford talk
about JavaScript early years in this talk
[http://www.youtube.com/watch?v=JxAXlJEmNMg](http://www.youtube.com/watch?v=JxAXlJEmNMg)

