JavaScript Is Not Typesafe

17 Jan 2024

JavaScript! Say what you like about the syntax of Java, Dude, at least it’s typesafe - Walter, “The Big Lebowski”

As a complete beginner to JavaScript, I was practicing using FreeCodeCamp’s exercises to prepare for my Software Engineering course, which is based in JavaScript. There I learned about the many interesting unique syntaxes of JavaScript, especially with ES6. My main language is Java, so learning JS wasn’t a massive leap for me, but it was still a challenge.

I think that JavaScript is a good programming language with strong potential. I found the lack of type safety to be a bit confusing, and I almost wish I could use a version of JS with type safety. I feel the same about Python; to me, it makes more sense to have type safety. This is probably just due to my experience programming in Java and C++, as untyped languages have many benefits as well. But, it adds a massive challenge when trying to read someone else’s code or even trying to trace my own code. I often have to look ahead to determine what the variable is actually being used for.

One new thing I was shocked to discover was the delete keyword. It is used to delete a property from an object. It is important to note that it will not delete the object itself, only the property. The syntax is as follows:

delete object.property;

I also learned about arrow notation. It is a more concise way to write functions. Interestingly, arrow notation does not have its own ‘this’ value. It uses the ‘this’ value from the surrounding code. The syntax is as follows:

const myFunction = (param1, param2) => { // function code here };

I am excited to learn more about JavaScript and how it can be used in web development. I am also excited to learn more about the unique syntaxes and features of JavaScript. I believe that JavaScript will be a valuable tool for me as I continue to learn and grow as a software engineer.

I love the Workout Of the Day (WOD) system that the course uses. I have found the practice WODs to be very helpful in my introduction to JavaScript. They force me to actually try and apply what I have learned by writing code and solving a unique problem. They can definitely feel stressful, but I think that is a good thing. I find them to be pretty fun at times too, they present really unique challenges that force me to think outside the box. Having to work without outside help and limited internet access is also a good method to help me get better at programming. It is important to be able to write code under pressure, and the WODs help me to do that.