JavaScript vs Java?

Javascript coding ..

Moderators: gesf, Michalio

Post Reply
User avatar
New php-forum User
New php-forum User
Posts: 17
Joined: Thu Feb 24, 2022 5:08 am

Just wondered how different JavaScript is from the actual Java language, and how much work it'd be to learn one of them if you know the other. I'd love to hear what everyone thinks on this!
User avatar
Posts: 130
Joined: Sun Jul 18, 2021 1:33 pm
Location: Poland

Java and JavaScript are different languages.
These names are similar because creators of Java language wanted that, that's all.
Both are used in different way, to different purpose. Simply: the largest similarity is their names :)
Free coding lessons:
php-forum Active User
php-forum Active User
Posts: 37
Joined: Wed Apr 27, 2022 11:24 am

matthew92 wrote: Tue Mar 15, 2022 11:05 am Just wondered how different JavaScript is from the actual Java language, and how much work it'd be to learn one of them if you know the other. I'd love to hear what everyone thinks on this!
They are not similar by any stretch at all. As Michalio said, the name similarity is pure coincidence. Both were originally released in 1995, Javascript by engineers at Netscape and Java by engineers at Sun Microsystems. Coffee (or the caffeine in coffee) is and always has been every intellectual's favorite addiction, and java is another name for coffee.

The Java language requires the Java Runtime Engine (JRE) which is a performance drag and a sucking chest wound in your computer security. More recent versions of JRE have claimed to "fix" the security issues, but in reality all they did was change the defaults from "open to everything from everywhere" to "open only to locally stored files" and in most cases you have to re-open all the crap before anything more complex than "Hello World!" will work.

Javascript was presented to ECMA International as a new standard in 1996 or 1997, and was accepted for standardization, so the proper name for it now is ECMAScript. Javascript was created so that the Netscape web browser could compete with Internet Explorer (IE). At the time, IE allowed client-side automation via Visual Basic Scripts (VBS) embedded in webpages and the VBS runtime engine was proprietary, so Netscape had to come up with their own thing.

ECMAScript has always been C-like in syntax. Object Oriented Programming was always possible by way of complicated embedding of functions within functions, but data persistence was only possible if you did something wonky like hitch a class-level variable to an HTML Element, then refer to the HTML Element Instance instead of the function. I have seen recent code snippets of Javascript using real class declarations, but I would not touch that code.

Java has always been Object Oriented in syntax, meaning you can declare classes. JRE can also be hooked up to your webbrowser (or for a really long time that was a thing) so they tried to market themselves as an alternative to VBS and ECMAScript because the one automation set could run with any browser if JRE was installed. The problem became JRE's propensity to take and run anything/everything. The fact that VBS and ECMAScript have always protected the user by preventing direct access to all but a few specific hard drive directories, while JRE has always allowed absolutely any Java program to do anything it wants with the whole computer, led to Java programmers becoming little more than a cult of personality while the World Wide Web Consortium (W3C) adopted ECMAScript as its standard automation language, finally putting to bed the melodramatically titled "Browser Wars."

I hope this helps clarify the difference between Java and Javascript.

Edit: Because IE required VBScript and Netscape required Javascript, for several years there was this awful condition where web developers had to choose which browser their site would support, or build different sites for IE than for Netscape. With a lack of AJAX and no real standard for HTML (including no Document Object Model aka DOM), there may or may not have been a USER-AGENT header in requests from any browser, so for quite awhile web developers had to build a landing page using basic HTML and provide explicit links to the IE Version or the Netscape Version of their main site for users to pick from. That was why JRE ever gained popularity in the first place, as described above. This massive Charlie Foxtrot was dubbed "Browser Wars," when, "Big Tech Acting Like 2-year-olds" would be more accurate. I looked up "Browser Wars" and found a Wikipedia entry which is just a bunch of nonsense, so I felt like I should clarify that too.
Post Reply