Javascript is Better than I Thought

21 Jan 2020

Preconceptions

Coming into this course I actually dreaded having to work with Javascript. Browsing programming related forums led me to believe that the language was supposed to be the bottom of the barrel, and insufferable.

Not only that, but I have also had my own bad experiences as well. I’ve worked a bit with Angular (a web development framework) and React/React Native. Those frameworks use Typescript and Javascript as their languages. When I first started learning those frameworks, I did not stop to actually learn the language they used.

Pure JS

All of that together made it hard for me to differentiate from what was Javascript and was part of the framework. After going through the FreeCodeCamp exercises, I started to have a change of opinion. Some of the JS design decisions with arrays were actually pretty cool.

  const mixedArray = [1, "2", [1,2,3], "hi mom!"];

The ability to write arrays with mixed datatypes was something that I could immediately think of benefits for despite my mind telling me something is very wrong about that.

Alongside that, being able to return multiple datatypes in functions is a particularly nice feature.

First Workout

However, It wasn’t until I attempted my first Workout of the Day (WOD) that I really saw what made Javascript special. I don’t think I had to think about programming for more than 10 seconds when I wrote that program. I thought, “I need loop and a switch” and then I just started coding.

Once I got into it it finally clicked. It felt as if my actual code was pseudocode. There were no thoughts about typing, or random errors, just simply typing. When all was said and done it ended up being one of the fasted programs I’ve ever written in my entire life.

The WOD itself was relatively easy, and I think if they stay easy to moderate, I will continue to enjoy them. The timing part of the exercise is not something I necessarily enjoy, however I get a small thrill from being put under pressure. So, as long as my times do not get close to the red zone, I will like them.

Closing

Before this class I had plenty of time to work with other languages. In particular, Dart seems to be a close cousin to Javascript. Using tuples makes any programmer feel like a hero, and the spread ... operator is more than a mild convenience.

So, is Javascript a good language? Well I suppose it depends. Perhaps my mind will change later on but if I were to consider programming languages as a toolbox, then Javascript might well be a hammer. It is pretty good for getting things done with no nuance, but any toolkit would appear lacking without one.