Journey Through JavaScript

31 Aug 2023

Learning a new programming language has always filled me with both excitement and trepidation. On one hand, learning how I can apply the language to solve new problems feels like gaining access to a key that can unlock new possibilities. On the other hand, hitting the roadblocks that come with learning something new can be frustrating and demoralizing. So far, learning the basics of JavaScript has been smooth sailing, as it shares many aspects from other languages I have learned in the past.


A Marriage Between Python and C


If you’ve coded in C or C++ before, the similar syntax will make you feel right at home with JavaScript. From using curly braces ‘{}’ to define code blocks, to having identical structure with their for loops and if statements, these two languages have shared design patterns that can ease the transition for programmers experienced with one beforehand. The switch statement also makes a welcome return to improve efficiency and readability of conditions checked against a single value.

Of course, syntax is not the only aspect of a programming language that one must learn. Just like learning a new spoken language, merely grasping the grammar will not prepare you for having fluent conversations. In the case of JavaScript, there are fundamental characteristics that I needed to recognize in order to avoid pitfalls. Just like Python, JS is a dynamically typed language; meaning that you do not need to declare the data type of a variable explicitly and the type of the variable can change at runtime. When this was first exposed to me, I thought back to my time transitioning from my first language Python, to my second language C++. I kept thinking to myself, ‘Why do I need to take the extra step and declare the type of every variable?’ I had missed the flexibility offered by Python in this regard. However, I now find myself with the complete opposite sentiment transitioning to JavaScript as I understand the potential bugs that can come from variables with mismatched types and unseen conversions.

Standing Out in the Code Crowd


Even with its similarities to C and Python, JavaScript still has some quirks that separates itself from other languages. For example, using the ‘let’ and ‘const’ keywords makes the code more readable and efficiently conveys which variables can be changed. The strict comparison operators are also a welcome addition to catch any errors with dynamic typing. I especially appreciate the inclusion of Promises which seems like it can prove useful for web development.

A Final Word


So far, I have barely scratched the surface of what this language has to offer. I plan on treading carefully as I try to wield the flexibility that JavaScript offers with responsibility. It will certainly be a challenging transition coming from an untyped language like C. I am excited to see what new possibilities are unlocked as I continue to develop my JavaScript skills.