Learning Java or Javascript?

Learning Java or Javascript?



I know a little about Javascript and Java, both at almost equal level I would say (but a little more Javascript with Node.js and React.js I would say).

I would like to immerse myself deeply into either Java or Javascript, but I don’t know which language to chose.

I know you can do pretty much everything with Java, but it’s rather more cumbersome to learn, more restrictions.

Javascript seems easier to learn, with many frameworks, etc but less normative.

I hesitate. Can I really develop any type of application with Java? And what about Javascript? I know one can do back-end development with Javascript now, but originally it was only front-end oriented.


I think you should figure out what you want to do with the language first, before choosing, as you should with any language! Every language has its strengths, and many people don’t take the time to look at those before choosing a language to study.

I’ve worked with both languages, although more extensively with Java since it’s one of the primary languages used in my CS degree, and I can honestly say that my learning curves for both languages were roughly the same. Java tends to look daunting to people just starting out, but (speaking from personal experience) once I got over the initial shock, I actually found it pretty comfortable to work in. The difficulty of a language can definitely be a factor, but I wouldn’t let it hold you back from choosing a language over another.

Instead, like I said before, try to figure out what your main goal is for learning a language. If you’re learning the right tools (or language, in this case) for the things you’re trying to develop you’ll probably be (a teensy tiny bit) less discouraged, haha.


Nice gravatar “moonshoes”! Precious! :slight_smile:


My opinion is biased because I have worked a lot more in JavaScript than Java, but I have done a decent amount in C# and a small amount in Java to at least have an idea of what it is.

JavaScript is easier to learn, but I would say harder to master. Sure, anyone can wire up jQuery animations and event handlers and say they are competent with JavaScript. How many JavaScript developers can explain to you how the prototype system works; how the this mechanism works; how to handle asynchronous flow; how the latest features such as Promises, Async functions, Generators, Data types, and more all work; and how to implement design patterns such as functional programming, behavior delegation, closures, modules (UMD, CommonJS, ES6), and others? How many of those who know these things can apply it all too real life situations with so many libraries, frameworks, and tools that they are supposed to know? No, JavaScript isn’t really easier to learn, at least learn well. When it comes to the tricky parts in JS, many developers fall back to their safety net of traditional approaches: callbacks and promises are too hard, I want threads; functional programming and behavior delegation is confusing, why can’t I just have super complex hierarchical patterns with classes; no static types?!?, my programs will be full of bugs… blah, blah, blah. The list goes on and on, and on and on, and on and on.

Java is more traditional. It uses classes, static typing, etc. You shouldn’t be surprised by a lot of behavior in Java once you learn it. JavaScript is different, as there are quirky things that take time to master. That doesn’t mean you shouldn’t learn the language.

I will give you several reasons to learn JavaScript now:

  1. According to StackOverflow’s 2017 study, it is the worlds most popular language for professional developers dominating at 67% for the fifth year in a row. Java sits below in 3rd place at 38%.
    Node, angular, and react sit as the post popular technologies for professional developers:
    JavaScript continues to grow while Java features a slight decline:

    It is one of the most wanted languages:
    JavaScript’s tools sit at the very top of the most loved technologies:
    and at the very top of the most wanted technologies:
    My point here is that JavaScript is an extremely popular, needed, and respected language even with all the haters out there. While it is not the most loved or beautiful language, it is probably the language you will be expected to know for every web development job out there.
  2. It is the only language that works on the browser. Java can’t do this. If you have to work on the browser, you have to use JavaScript. JavaScript is even more popular on the backend than Java now:

    The bottom line is that JavaScript is everywhere, even places that Java is not. Because JS is on the client and server, it makes full-stack development much simpler and powerful. JavaScript is definitely a language you must know in the future. You might as well focus on it and learn it well.
  3. JavaScript has unique design patterns that allow certain programming paradigms. JavaScript is part of the Unix mindset that “small is beautiful”. This is seen in the patterns of functions and modules over classes and hierarchies. JavaScript has functional ideas that aren’t possible in a lot of purely object-orientated languages. You can use both functional and object-oreintated patterns that make the language possible for a wide array of design implementations. Once you learn the prototype mechanism, it becomes much simpler to implement and connect objects rather than the traditional class based patterns which can often over-complicate things.
  4. JavaScript is continually improving. Consider this popular example of “callback hell”:
fs.readdir(source, function (err, files) {
  if (err) {
    console.log('Error finding files: ' + err)
  } else {
    files.forEach(function (filename, fileIndex) {
      gm(source + filename).size(function (err, values) {
        if (err) {
          console.log('Error identifying file size: ' + err)
        } else {
          console.log(filename + ' : ' + values)
          aspect = (values.width / values.height)
          widths.forEach(function (width, widthIndex) {
            height = Math.round(width / aspect)
            console.log('resizing ' + filename + 'to ' + height + 'x' + height)
            this.resize(width, height).write(dest + 'w' + width + '_' + filename, function(err) {
              if (err) console.log('Error writing file: ' + err)

Compare this to Promises and then Async/Await:

function apiDoSomethingMoreComplex(withThis) {
    const urlA = '...';
    const urlB = '...';

    httpLib.request(urlA, withThis).then(result => {
        const parsed = parseResult(result);
        return new Promise((resolve, reject) => {
            database.update(updateStatement, parsed).then(() => {
            }, error => {
    }).then(result => {
        return httpLib.request(urlB, result);
    }).then(result => {
        return worker.processData(result);
    }).then(result => {
        logger.info(`apiDoSomethingMoreComplex success (${result})`);
    }, error => {
async function apiDoSomethingMoreComplex(withThis) {
    const urlA = '...';
    const urlB = '...';

    try {
        let result = await httpLib.request(urlA, withThis);
        const parsed = parseResult(result);
        await database.update(updateStatement, parsed);
        result = await httpLib.request(urlB, parsed);
        result = await worker.processData(result);
        logger.info(`apiDoSomethingMoreComplex success (${result})`);
    } catch(e) {

With promises, generators, async functions, and async iterators (coming soon) you can easily create very flexible and readable async patterns. Not to mention the additions of ES6, ES7 and soon to be versions: let, const, arrow functions, object literals, template strings, iterators, for…of, array.prototype.includes, default parameters, spread, destructoring, modules, set, map, symbols, proxies, typed arrays, and more. And I failed to mention WebAssembly which is a whole new post in and of itself.

TL;DR - JavaScript is a great language that is extremely popular, wanted, loved, and growing. You really can’t go wrong if you decide to learn it.


Javascript is primary a web-browser and server-side (node.js) based scripting language whereas Java is commonly used for desktop based apps. There are as always exceptions to both of these things. I recommend learning javascript since it’s used for just about everything related to freeCodeCamp :slight_smile:


this is a javascript community - I doubt you’ll hear any voices favoring another language

I like javascript because it’s fun and cool

I really love the simplicity and minimality of js syntax - you want an array - just put brackets around something - you want an object - put name:value pairs in braces - you want a simple lambda squaring function x=>x**2 is all you need

we know js has long been the king on the frontend but it’s the recent advances in v8 and chrome that are simply incredible - I feel I’d be a fool to not take advantage of it

on the backend I think nodejs was the first and still the only platform that absolutely nails the fundamental issues of scalable server software based on the nonblocking async eventdriven model of javascript

all this together means I can write a complete seriously capable client-server application in javascript - I cannot say that of any other language in the world


I think spamming paid-for courses on a free coding forum is very poor form

If anyone else reads this thread I emplore you to find absolutely anywhere else than that site, literally anywhere that doesn’t stoop as low as what could possibly amount to as a scam

I would start with the following free resources: https://github.com/EbookFoundation/free-programming-books/blob/master/free-programming-books.md#java


You cannot compare java and javascript. Both the languages have their own characteristics.
If you are beginner, I would suggest you to go with Javascript and then java.

Hope this will help you learning both the languages.
Happy learning.


If you are asking this question, you should probably learn a bit more about coding in general - especially the difference between Front End and Server Side programming.

There’s a very good beginner’s guide over at Code School: