I had the privilege of starting to learn how to code at a young age. While this has its benefits, I still think it is never too late to start. It is going to be a bit harder for you to create the coding habits that you will need, but it is totally worth it, and not just financially. Coding is my hobby and I hope for you to join the club, one whose members make money doing what they absolutely love to do and are willing to do it just for fun!

While learning how to write computer programs is fun, it is not easy. However, getting started to understand the basic concepts of programming is easy. This is what this book is all about. If you are someone whose entire coding experience is just what they heard from others about how cool coding is, this book is for you. It will transform you into someone who can write simple programs to solve actual problems.

However, this book will not make you a professional software engineer. You are going to need a few dozen books to get there. The goal of this book is to simply get you started.

The secret of getting ahead is getting started.
— Mark Twain

Why JavaScript

You might have heard that JavaScript is not the best of computer languages. This is somewhat true.

JavaScript was initially designed by Brendan Eich in about 10 days, which is a very short period of time to design a computer language. This means that the language had a lot of problems and bad parts. For the longest time, professional software developers did not like JavaScript because of its quirks and odd behaviors. However, this is changing today.

I was in that same boat just a few years ago; I was not a fan of JavaScript. However, I am in love with JavaScript today. I even totally broke up with the beautiful Ruby (after a 10-year relationship) to exclusively date JavaScript. I am happier with JavaScript.

JavaScript has changed. The bad parts were kicked out and what remained turned out to be a beautiful and very flexible language. The TC39 committee, who is responsible for maintaining ECMAScript (the standard behind JavaScript), is carefully introducing more great features into the language.

Today, there are many reasons to adopt JavaScript, even as a first language:

  • JavaScript is the only language that can be used for true full-stack web development in major browsers.

  • JavaScript has the largest ecosystem of wonderful tools, libraries, and frameworks that are used by small and big teams.

  • You can test JavaScript code in the browser without any setup. JavaScript is flexible to a fault. It can be whatever you need it to be (object-oriented, functional, procedural, imperative, declarative, event-driven, &)

  • JavaScript is dynamically typed, but you can easily add static type checking during your development workflow. This uniquely position the language to offer the great advantages of both coding styles, even in the same project.

  • JavaScript has no weird and hard-to-read indentation-based (off-side) blocks. * JavaScript has a very small standard library that covers the absolute basics. After that, you get to pick what you need rather than having a large standard library that you will mostly not use. The lack of a full standard library also forces you to write and test simple operations yourself, which I think is a plus.

  • Thanks to browsers and Node.js, JavaScript is - or can be - available on nearly every device you need to work with. You can be a productive programmer who only knows JavaScript.

  • JavaScript makes it easy for you to make mistakes, which speed up your learning curve if you are generally following good practices about finding mistakes early.

  • Nearly every programmer on Earth knows a thing or two about JavaScript. This means getting help is easy.

  • JavaScript is controlled by a wonderful committee (TC39) who takes things seriously when it comes to adding new things to the language and deprecating old things.

  • Many other languages compile to JavaScript. If the official syntax bothers you, you have options.

  • JavaScript is not going anywhere anytime soon. It is the safest bet when picking things to learn.

Nevertheless, some people will continue to hate JavaScript. I think people who hate JavaScript today are probably in one of the following seven categories:

  1. People who hate the Document Object Model (DOM) and mistakenly think that they hate JavaScript. The DOM is an application programming interface (API) for HTML documents. It is the interface that we can use to instruct web browsers to change these documents' structures, styles, and content. The DOM API is not part of JavaScript. It is just written in JavaScript.

  2. People who hate the frameworks and libraries written in JavaScript which are, just like the DOM API, not part of JavaScript. They are just written in JavaScript. Hating JavaScript because of a bad library is like hating English because of a bad book.

  3. People who hate the Event Loop and mistakenly think they hate JavaScript. Every browser has an event loop to queue and process messages. This enables the browsers to execute some code in different threads without blocking the main thread that is available for the UI. The Event Loop affects the way JavaScript is written for the browser.

  4. People who had to write different versions of JavaScript to accommodate browser differences. This is not a JavaScript problem. This is a BrowserS problem.

  5. People who depend on big, standard libraries in other programming languages and find the lack of one in JavaScript a reason to hate it. I find the exact same point a reason to love JavaScript! It has just the absolute minimum of a standard API and then does not assume anything beyond that.

  6. People who are easily overwhelmed with the amount of packages, tools, and things they need to learn to work with JavaScript in different environments.

  7. People who cannot learn JavaScript although they try hard to. Hearing that JavaScript is so simple to learn and yet struggling to learn it makes you hate it.

If you identify with this last category, I hope that this book will help you.