+ 5

Java or JavaScript?

What is the difference between the two languages? I don't get why there have to be so many languages with little variation

7th May 2017, 12:53 PM
Pete Cowling
Pete Cowling - avatar
9 Antworten
+ 13
JavaScript: - traditionally it used to be a front-end language, since you can create beautiful user interfaces with it, e.g Angular/AngularJS, React. Nowadays not anymore limited to frontend since nodeJS (Backend), Espurino (Hardware), Cordova/Phonegap (Android, iOS, Windows, Blackberry, ...and many more) - mostly written for web applications - interpreted language by the JS engine - is a loosely typed language, i.e. a variable can dynamically change it's type, meaning it can hold a any number, String, and/or any object - everything is an object - even it's type - is a multiparadigm language, i.e. procedural, functional, object-oriented. Mainly with it's focus on the first two. - single threaded Java: - traditionally a backend language - mostly written for enterprise applications - compiled and interpreted language - is a strictly typed language - has primitives and objects - is a object-oriented language. Eventhough with Java8 and the introduction of lambda espression, functional programming is now natively supported - multithreaded But the borders between them diminish every day. For example: - With webAssembly you can now not only run JavaScript but also compiled languages, e.g. C/C++, Rust, on the browser. In the future every language should be supported. - With Java 8's Nashorn, you can run JavaScript on the JVM (Java-Virtual-Machine). So, both compliment each other rather than compete with each other.
7th May 2017, 1:18 PM
Thanh Le
Thanh Le - avatar
+ 7
Java as Imran said it is everywhere
7th May 2017, 1:29 PM
Vaibhav Sharma
Vaibhav Sharma - avatar
+ 4
The two languages are completely unrelated.  JavaScript was originally called Livescript, and was renamed when Java was introduced as a kind of cross-marketing.  There was some hope that they'd be used together and evolve together.  They never really were; Java applets never took off.   The two languages have some surface similarities.  They're both procedural object-oriented languages, so they look more like each other (and like C++ and C#) than they look like, say, Prolog, Lisp, or Haskell.  But within that range, they could hardly be more different.  Java is strongly typed, while JavaScript is weakly typed.  JavaScript has first-class functions; Java lacks them.  Java is class-based; JavaScript is prototype-based.  Java is distributed as compiled bytecode; JavaScript is distributed in its source code. Experience in one prepares you for the other no more than any other common programming language, like C or Pascal.
7th May 2017, 1:05 PM
Ashok Kumar
Ashok Kumar - avatar
+ 3
Sorry but JavaScript is more "everywhere" than java today. your JavaScript is likely to run on every device that can run a web browser. Your java program won't run on mobile, and for the people that will rage because android apps are coded also in Java, IOS won't run java anyway. So if you are after the old WORA concept, today JS is more ubiquitous than Java.
7th May 2017, 5:07 PM
seamiki
seamiki - avatar
+ 2
So Java is useful for almost anything but not designed to be specific to one point in programming?
7th May 2017, 1:02 PM
Pete Cowling
Pete Cowling - avatar
+ 1
JavaScript is used for web, that is, JavaScript is part of web development. Java, on the other hand...well... "write one, run anywhere". Java is used in many, many places. Hell, Android is based on Java!
7th May 2017, 12:57 PM
Imran Isak 💻
Imran Isak 💻 - avatar
0
Java is everywhere, an "all-round" language.
7th May 2017, 1:04 PM
Imran Isak 💻
Imran Isak 💻 - avatar
0
@seamiki you do have a point
7th May 2017, 5:08 PM
Imran Isak 💻
Imran Isak 💻 - avatar
0
@AG it's ridiculous that you can install a JDK on a Raspberry pi but you can't do the same on your android device. Hope google and oracle will bury the hatchet some day... or better, that dmobile devices start becoming less locked than they are now...
7th May 2017, 5:27 PM
seamiki
seamiki - avatar