+ Reply Thread
#1
#2
In the 90's while Java was selling as the language for every platform using write once run everywhere. Netsacape(the original company that owned the language before being adopted by ECMA) tried to sell the language and make it known so they name it JavaScript. At first when people hear it they are freaked that it has something to do with java, whereas it is totally not. It was the idea of NetScape to sell it and it is being bought.


Now let's talk about how Java and JavaScript differ.
  • The main difference is that Java can stand on its own while JavaScript must (primarily) be placed inside an HTML document to function
  • A Java "applet" (so-called because it is a little application) is a fully contained program that can run in the browser. JavaScript is text that is fed into a browser that can interpret it and then it is enacted by the browser
  • Java is a more complicated language that can be used to create a fully functional and non reliant desktop app. Although today's web apps are starting to blur the line between traditional desktop applications and those which are created using the traditional web technologies: JavaScript, HTML and CSS.
  • Java must be compiled into what is known as a "machine language" before it can be run on the Web. JavaScript is wholly reliant on the browser to understand it and make it come to life.

Now to clarify your further, some points are:

Java is a statically typed language - you can declare a variable to be of a particular data type and as well create custom data type for that variable); While JavaScript is dynamic, a variable does not need to have a particular data type (This is changing now with ES16)
Java uses classes to group and make it objects and variables, JavaScript is prototype-based.
In Java you end statements that are not block with semicolon, while Javascript doesn't need that. You can end a statement without semicolon.
Java constructors are special functions that can only be called at object creation; JavaScript "constructors" are just standard functions.

The list is on on and on. Just accept the fact that JavaScript is different from Java. As python is golang is different from Java, meaning that they have almost similar names doesn't mean that they do the same thing.
#3
Nicely written
#4
Glad it helped
#5

Nice :)

Back to top