Ah, JavaScript, the first programming language I learned and sort of achieved intermediate status. I say 'sort of' because I still struggle immensely at times to figure out if I can do or use certain things here or there, or why a value changed from one type to another without errors. If you know what I'm talking about, you feel the pain. If you don't, let me tell you why you should learn JavaScript.
Versatility
Once you learn JavaScript, you can use it to build anything. It runs on the front end, back end (Node.js), and even on mobile and desktop applications. For those looking into to get into the web development domain (no pun intended), and want to create website applications and visually see your work immediately, then JavaScript is great. JavaScript is the programming language that browsers understand. Want to build a server? Use Node.js. Want to build a dynamic and interactive website? Use JavaScript in the browser. It's perfect for those 'all-in-one' folks. Just open a browser, and you can start coding. This instant feedback makes it a great language for learning programming basics.
Syntax
If you've read my "Why You Should Learn Python" article, you'll remember that syntax plays a big part in learning Python, or really any programming language. JavaScript is similar, in that its syntax is relatively easy to get started with, compared to other languages, such as Java or C++. Compared to Python's no-use of curly braces and semicolons, you might find using those might make your code easier to read. JavaScript uses curly braces to separate blocks of code and scope functionality, which can visually separate your logic. Semicolons are similar to how we end sentences with periods, they signify an end of a statement in JavaScript, which can help use visually see where a statement or block ends.
Forgiving... but not.
You're probably thinking: '...what?' Trust me when I say that the JavaScript programming language can be very flexible and forgiving with its rules. This can be both a benefit and a challenge, especially for beginners. When I was first learning about variables, I went a little wild, defining variables with any value I could think of. I didn’t consider how my variables’ types might change or lead to logical bugs. Once I defined a variable, I didn’t worry about how it would interact with other variables—I just focused on the end result. You'll experience this when you get to Type Coercion and Dynamic Typing.
This flexibility is great for beginners because you don’t need to worry about data types; JavaScript figures it out as your code runs. However, this can lead to logical errors that can be frustrating. For example, adding a string and a number is perfectly valid in JavaScript, but it may give you unexpected results. Trust me, these are bugs you'll see quite often when starting out. Essentially, JavaScript allows beginners to get away with mixing types, making it faster to see results without strict rules.
Let's not talk about how the 'this' keyword works... Kidding aside, 'this' can refer to different things in different contexts, where you call a method, etc. It's another weird and complex concept in JavaScript that you will definitely need to know.