What's the difference between JavaScript and J

2018-12-31 00:05发布

What's the difference between JavaScript and Java?

15条回答
零度萤火
2楼-- · 2018-12-31 00:27

Practically every PC in the world sells with at least one JavaScript interpreter installed on it.

Most (but not "practically all") PCs have a Java VM installed.

查看更多
长期被迫恋爱
3楼-- · 2018-12-31 00:30

Take a look at the Wikipedia link

JavaScript, despite the name, is essentially unrelated to the Java programming language, although both have the common C syntax, and JavaScript copies many Java names and naming conventions. The language was originally named "LiveScript" but was renamed in a co-marketing deal between Netscape and Sun, in exchange for Netscape bundling Sun's Java runtime with their then-dominant browser. The key design principles within JavaScript are inherited from the Self and Scheme programming languages.

查看更多
怪性笑人.
4楼-- · 2018-12-31 00:31

They have nothing to do with each other.

Java is statically typed, compiles, runs on its own VM.

Javascript is dynamically typed, interpreted, and runs in a browser. It also has first-class functions and anonymous functions, which Java does not. It has direct access to web-page elements, which makes it useful for doing client-side processing.

They are also somewhat similar in syntax, but that's about it.

查看更多
其实,你不懂
5楼-- · 2018-12-31 00:32

Everything.

JavaScript was named this way by Netscape to confuse the unwary into thinking it had something to do with Java, the buzzword of the day, and it succeeded.

The two languages are entirely distinct.

查看更多
泪湿衣
6楼-- · 2018-12-31 00:33

They are independent languages with unrelated lineages. Brendan Eich created Javascript originally at Netscape. It was initially called Mocha. The choice of Javascript as a name was a nod, if you will, to the then ascendant Java programming language, developed at Sun by Patrick Naughton, James Gosling, et. al.

查看更多
一个人的天荒地老
7楼-- · 2018-12-31 00:35

One is essentially a toy, designed for writing small pieces of code, and traditionally used and abused by inexperienced programmers.

The other is a scripting language for web browsers.

查看更多
登录 后发表回答