The Javascript Language: From a Beginners Perspective

16 Jan 2024

“In learning you will teach, and in teaching you will learn.”

As my first time working with Javascript, I believe that it is a language that would be best to learn after having a solid foundation in Java or another similar language. It bears many similarities to Java as its name implies, but somewhat simpler. My first thoughts were that it reminded me of a Python-ified Java language of sorts.

Comparison to Other Languages

Something that made itself clear was Javascript’s affinity for concise code. Javascript allows much versatility, what I feel to be cutting back on many of the “formal” and “strict” code formats and allowing its users to choose between a fully written out, clear code or taking a viable shortcut for less typing. It offers this choice in many different areas that aren’t seen in most other languages like C, C++, or Java. There are different ways to declare a function (e.g. arrow functions and default parameters), different ways to create objects and their properties (e.g. property shorthands), and alternatives to conditionals (eg. ternary operator). The language also takes care of some of the more tedious heavy work in place of the user, with the introduction of rest parameters/elements and destructuring. The function that it offers can be coded by hand, but is made much easier and shorter by just utilizing the simple syntax of ellipses and a couple of curly braces. Another notable difference is datatypes of variables do not need to be listed before the variable name; the CPU will assume for you.

Things to Look Out For

However, a downside that I realized in my learning of Javascript also stemmed from its conciseness. With the many shorthand syntaxes built into the language, it can be much harder for beginners, especially those who do not have experience with other languages, to decipher what a block of code may mean. It can encourage clutter if not careful. When working in a team, as many contemporary development companies do, readability is a big issue when the same code is being passed through a dozen or more hands. Other languages have everything laid out, shortcuts are few and often times typing the whole code is considered better practice when learning. Javascript’s freedom for users in selecting their coding style may lead to confusion in group work. The CPU taking liberty in assuming things can also lead to errors in the code such as type mismatch as the user itself did not specify what a variable falls under. The nuances between declaring variables as var, let, const, and applying Object.freeze() can lead to unforeseen scope and assignment errors.

Final Thoughts

With Javascript’s popularity, you are bound to work with it eventually. That popularity is by no means misplaced, it takes care to bring much of the useful and familiar concepts and syntax from languages before it, while also providing its users with a sense of relief from some of the more tedious and monotonous tasks; introducing new practical functionalities to be applied in code. Its advantages are best appreciated if having had experience in another language, and will be easier to learn and become familiar with than if you were to go from Javascript to another. Experience will also aid in circumventing its disadvantages and help one to troubleshoot common errors effectively. Overall, Javascript is a great language with its own pros and cons, a language that would nevertheless be a smart choice to have expertise in.