-3

I'm kind of new to programming and i have a question that's been bothering me for awhile.

Why is the JavaScript-language different in different programs/sites. I've used Codecademy to practice and i've noticed it's different from Eclipse and Unity.

For example, in codecademy, you use: var blabla = "something" to declare a variable. In eclipse though, you use: int x = 2, String x = "hey".

Why is it like this? Thanks in advance.

closed as unclear what you're asking by Wayne Molina, user40980, user53019, Ampt, gnat Aug 6 '14 at 3:53

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 15
    Java and JavaScript is not the same thing. – Tommy Andersen Aug 4 '14 at 17:40
  • 1
    Javascript is not Java -and there are many other programming languages (Haskell, Ocaml, Scala, Common Lisp, Scheme, Prolog, etc.....) – Basile Starynkevitch Aug 4 '14 at 17:41
  • 2
    As people said Java and Javascript are very different languages. Don't feel bad, it's like the names are delibaretly confusing. – Aviv Cohn Aug 4 '14 at 18:05
  • I thought JavaScript was renamed to ECMAScript a few years back? Not that it matters anyway, the old name stuck. – user22815 Aug 4 '14 at 18:30
  • 1
    @Snowman JavaScript is superset of ECMAScript – Tommy Andersen Aug 4 '14 at 21:01
11

Java and JavaScript are two different languages, see this answer on Stack Overflow: https://stackoverflow.com/a/245068/111143

My guess is that Code Academy uses JavaScript, and Eclipse uses Java internally. Though the name sounds similar, they are not the same.

JavaScript is an ECMAScript dialect, and there are several dialects of this, that are often used in client side software for scripting. Often code that looks a lot similar to JavaScript, is a different ECMAScript dialect, like JScript, og ActionScript.

Java on the other hand is not an ECMAScript dialect, it is a wholly different programming language, JavaScript is named after Java since it was planned as a complementary scripting language for Java, after Netscape and Sun made a license agreement, it was originally called Mocha: https://stackoverflow.com/a/2018747/111143

  • ouch, that actually hurt a little, i had no clue... So then what do i do... What should i learn, should i just skip codecademy or is it good to practice javascript aswell just to get the hang of programming in general? ty for your answer though – stabbarey Aug 4 '14 at 17:52
  • With programming once you learn one language, learning another becomes much more easy. It is often the concept of programming that one struggles to learn at first, once you got that right the syntax of the different languages, are easy to learn. In my opinion it doesn't matter which language you learn first. – Tommy Andersen Aug 4 '14 at 17:55
  • 1
    Java and JavaScript are two completely different worlds. Given where trends are taking us right now I'd suggest JavaScript. Even though JS gives me personnally somewhat uncomfortable feeling, being accustomed to strongly typed compiled languages. – Mikko Viitala Aug 4 '14 at 18:07
  • @stabbarey - Don't sweat it. You'd think an industry composed mostly of people who take things literally would have avoided this naming confusion like the plague, but there's a little sales and marketing guy in all of us. – JeffO Aug 4 '14 at 18:55
  • @JeffO one of the original, intended, uses for JavaScript was as glue between the browser page and the applet as described in Invoking JavaScript Code From an Applet or conversely, Invoking Applet Methods From JavaScript Code - to an extent, it was intended as a scripting language for Java. And while Java applets are mostly obsolete because of the additional power of JavaScript itself. – user40980 Aug 4 '14 at 22:33

Not the answer you're looking for? Browse other questions tagged or ask your own question.