Is JavaScript Worth Learning?

03 Sep 2020

Introduction

My journey as a programmer began with Java. Learning to code for the first time was a big challenge. There were just so many topics that I had to cram into my head. The difficulty of these topics varies but still requires lots of time to understand and to become proficient. Eventually I began to love the language. After a couple of semesters of Java I continued learning more coding languages such as C and C++. But Java continued to be my favorite language with C being my second favorite. Here I am taking a software engineering class learning a new language called JavaScript. So, is this a language worth learning? The Short Answer is yes.

Expectation

Prior to taking Software Engineering I had no experience with JavaScript. All I knew at the time was it is used primarily for websites. But I did not know how it is used. So, I mistakenly assumed that JavaScript was what created the layout and design of the website. Only after a couple days of taking this class did I realize that JavaScript is what makes the website interactive and responsive. Since JavaScript is the programming language for a website, I would have to start learning the basics. And it turns out, it’s actually not bad.

Learning the Basics

To learn JavaScript, I used a helpful website called Code Academy. Using this site, I was able to get the basics of JavaScript as well as the new syntax for JavaScript called ES6 in just 4 hours. I was glad that I did not have to deal with pointers as I did in C and C++. The syntax and structure of JavaScript is very similar to Java. So, it was easy for me to adapt to the language. To ensure that we get enough practice or “workout” there would be these daily Workout of the Day or WOD. These WODs are very helpful in ensuring that we are constantly solving problems. Solving the WODs now may end up as problems we have to solve in the future. However, the WODs can be stressful as it does require some time and there are about 3 WODs weekly. The WODs for this course so far are at normal to easy difficulty. Just by doing these WODs I began to see how easier it is to write codes in JavaScript rather than in Java, C or C++. Just with those 4 hours at code academy and these WODs I began to favor JavaScript more than Java.

The Pros

There are features in JavaScript that I preferred. The first feature is the syntax of declaring variables. In my first lesson of learning JavaScript the major thing I noticed was the use of ‘var’, ‘let’ and, ‘const’ followed by a name to declare a variable. I always declare a datatype followed by a name to declare a variable because this is the format used for Java, C and C++. To me it’s bizarre that JavaScript knows if my variable is a float, integer, or a string without me having to declare the datatype. On my first WOD problem I would get syntax errors because of this. I had a habit of declaring my variables with data types. But after a couple of practice runs on jsfiddle this became less of an issue. The second feature is creating objects in JavaScript. If I were to create objects in Java, I would have to make a new class and make it implement my functions that are declared in my interface. Compared to JavaScript’s easy way by treating the objects like arrays. So, inside the object will have a property mapping to its value or key. The key can be strings, floats, integers, arrays, or another object. This feels more flexible and easier than Java. The biggest feature I noticed with JavaScript is the return type of a function. Java, C and C++, functions/methods must return either a void or a data type. While as JavaScript the function can return multiple data types. Even the way a function is defined in JavaScript is different. I recalled seeing 2 different ways to express a function, the normal way which is similar syntax to Java or by the arrow. There are more features of JavaScript that I have yet to fully grasp or learn.

Conclusion

JavaScript in general has its uses. I see it being much easier to write codes in JavaScript. But is it a good programming language? The answer is it depends on the type of project. As always certain programming languages would be best used on certain projects due to performance. JavaScript has its limits but is it worth learning? As I have mentioned before yes. It is like the other big programming languages. So, learning it just takes some practice and time. If you want to be a web designer, then JavaScript is a must. Therefore I am looking forward to learning more about JavaScript as I hope to become a web developer in the future.