Sign in
Log inSign up
Zero to One: How I mastered JavaScript and how you can too

Zero to One: How I mastered JavaScript and how you can too

Kleo Petrov's photo
Kleo Petrov
·Oct 30, 2016

JavaScript is everywhere these days - from web apps to mobile applications and servers. Its popularity skyrocketed in the last few years, surpassing languages like Java and PHP. There is no better time to learn JavaScript than now. In this article, I will explain how I started my journey, what I've learned on the way and how you can use it to master JavaScript.

A little bit of history

JavaScript was created by the talented programmer Brendan Eich in 1995. He was recruited by Netscape Communications, the company behind the first browser, with the difficult task to create a language that can make the Web more dynamic. After ten days, Brendan had a prototype of a scripting language, with syntax very similar to Java. That was the day when JavaScript was born.

In 1996, JavaScript was taken to ECMA to carve out a standard specification that other browsers could implement based on what was done. That lead to the first official release of ECMA-262. ECMAScript was the name of the official standard, with JavaScript being the most popular implementation.

Over time, several releases of ECMAScript were launched and ECMAScript version 3 was the widely supported version in the time of JavaScript's ascent to dominance, between the years 2000 and 2010. Every single browser supported it and thereby making JavaScript the language of the web.

There are developers who will say horrible things about the JavaScript language and many of these things are true. JavaScript accepts almost anything you type and interprets it in a way that is completely different from what you mean. "WTF" - that was my reaction when I typed my first few lines of JavaScript code and tried to execute them. I didn't know what I was doing back then and learned my first lesson the hard way - JavaScript is ridiculously liberal in what it allows.

The first steps

After my first confrontation with JavaScript, I knew I had to take things into my own hands. The first thing I did was to start reading different bits of tutorials. After spending two weeks, I found it was not what I was looking for. I had learned many things, but something was still missing. Then I realized that I had to make a plan.

My plan was simple:

  1. Learn how to learn and memorize things easy
  2. Learn the fundamentals of JavaScript
  3. Get into the deep and learn the advanced stuff.
  4. Start building projects.
  5. Create a flow of information about everything new in JavaScript
  6. Teach!

I like to call it "the long never-ending plan" and you will see why. I will cover all these topics one by one, but I would like to share a couple of things first. Know that your journey can be very bumpy at times and you may have times of total despair, but don't let this scare you. Everyone has gone down this road and even the brightest minds in programming were novice at some time. It's part of the process and you have to accept it as something normal.

So, without any further ado, let's get to the interesting parts. :)

Learn to learn

This is something I see being skipped by too many. Having a proper learning plan is fundamental to not only JavaScript learners but to everyone who is serious about programming. Things change too fast in the IT industry and developers need to know how to manage their "knowledge portfolio". Here are some ideas on how to do that.

Technical writing as a way of learning

Something that worked really well for me was writing everything I learned about. For example, you can create a blog journal and write there. If that is too ambitious for you, you can get a notebook and write in it. You will see the results in no time - not only will you train your memory, but you will also get a proper view of how well you understand the concept. Another big advantage of technical writing is that you will develop the skill to explain difficult things in a lucid way.

Practice tests

This is one of my favorite ways for fast learning. Traditionally, tests are seen as a necessary evil of education, but are actually a really powerful way for memorizing. So, how can you practise testing yourself?

The best way is to use flash cards. I use a free app called Anki, where I've created a list of flashcards for every new JavaScript related topic and start my day with 10-15 minutes answering these questions. It's a really fun and addictive activity. You will not only memorize better but also learn how to ask the right questions.

Take your time

The worst time for learning is when you feel tired or demotivated, so don't force yourself. Take a break for a day or two and get back only when you feel ready and motivated. I also strongly suggest using the Pomodoro technique. The idea behind this technique is pretty straightforward - you focus on a task for 25 minutes and rest for 5, then repeat again.

Find a mentor

Find someone who is an expert in JavaScript and ask them if they are okay with mentoring you. Finding a mentor can greatly increase your learning time and lower the frustration.

Fundamental JavaScript

Now that you know how to efficiently learn and memorize, you can start your real journey. We will start with the fundamentals. Because of JavaScript's popularity, there are TONS of resources to choose from. However, I will cover only the ones I personally find the best. You can choose any of them, as they provide great explanation of the language:

  • MDN's JavaScript Guide - After the launch MDN quickly became the de-facto reference for JavaScript, HTML and CSS. Their guide is very solid, covering things like grammar and types, loops, functions, expressions, numbers and dates, text formatting, etc.
  • You Don't Know JS - This is a book series by Kyle Simpson, where he dives into trickier parts of the language, talking about what scope & closures are, what is an object prototype and what is "this" in JavaScript. This series will take your skills up a level, giving you a thorough understanding of JavaScript—including the parts that many experienced programmers simply avoid.
  • Eloquent JavaScript - Another great free book about JavaScript, although I won't recommend it to the people who are just learning programming. If you have some previous experience with another programming language, go for it, otherwise, choose some of the other resources.
  • Free Code Camp - Free Code Camp is a community where you will work through self-paced coding challenges, build projects, and earn certificates. It's really fun to do and can be done simultaneously with any of the other resources.
  • CodeCademy - Another platform for JavaScript challenges. It's very beginner oriented and easy to use.

After finishing one or more of these, you will have a solid foundation of the language and you will be able to create your first programs and apps. This is where you may feel you know enough and your interest will start flitting from one topic to another. You may also find other languages interesting. Stay on track and focus! Don't let your demons take you over.

You may also feel anxious at times. There will be things you don't understand or problems you can't solve. Don't be afraid to seek help in these situations. Google your problem, search it on Stack Overflow or just ask someone. Always question everything and ask yourself why - "Why do I need to use a for loop, when I can use the map method?", "Why do I need jQuery, when I can use plain JavaScript?".

"I've learned the basics, what now?"

You are making progress, you know enough to be dangerous with JavaScript, but what now? This is the same question I asked myself when I felt I knew enough, but was still wanting more. This is the time when you realize that it's a lot harder when the hand-holding ends and it feels like you can't actually do anything on your own yet. Your primary challenges are constant debugging and not quite knowing how to ask the right questions as you fight your way towards any kind of momentum.

Your primary tasks will be to fix bugs you introduced somewhere in your code. Bug after bug, you will find that JavaScript is a lot harder than expected. This is the time when most people have to decide if they are ready to go full-on or leave.

Something that helped me overcome that phase was not panicking and knowing that this is a part of the process, and it would eventually pass. Having the right mindset (we will talk about that later) is beneficial. If you get the feeling that everything is hard and unknown, know that you are ready to take your skills to the next level.

Learning new things in this phase is kind of hard. The material has to be not so basic, but not so advanced either. So, I started searching and found lots of books about JavaScript best practices, testing, design patterns and code structure. Some of them were good and some of them were not. Here is a list of books that I find really interesting:

  • Effective JavaScript: 68 Specific Ways to Harness the Power of JavaScript - This book is organized into 68 proven approaches for writing better JavaScript, and is backed by concrete examples. You’ll learn how to choose the right programming style for each project, manage unanticipated problems, and work more successfully with every facet of JavaScript programming from data structures to concurrency.
  • JavaScript - The Good Parts - Although kind of outdated, this book is a great resource for every intermediate and advanced JavaScript developer. It's by the well-known Douglas Crockford, published in 2008. This book shows that JavaScript can be a beautiful, elegant, lightweight and highly expressive language that lets you create effective code, whether you're managing object libraries or just trying to get ajax to run fast.
  • JavaScript Design Patterns - With this free book you’ll learn how to write beautiful, structured, and maintainable JavaScript by applying classical and modern design patterns to the language. The explanation is just wonderful and the examples are more than understandable. A must-read book.
  • Test-Driven JavaScript Development - One of the best books about JavaScript testing, Test-Driven Development, and testing strategies.

Routines of a great developer

Although these books are a great source of knowledge, they are only a part of what you need to do to become really good in JavaScript.

Think of a blacksmith. He may know every little detail about his mastery, but without practice he is nothing. Same is the case with programming. If you don't practise and don't build things, you are probably doing nothing. So, my advice to you is - learn and code at the same time. Don't worry that your code will be sloppy and unoptimized. Just get an idea and start working on it. Create a GitHub account, commit every single day, and make it a routine. When you finish a project, share it with the world and seek feedback. Productive feedback is the most wonderful thing that can happen to you - you will learn about the new best practices, code linting, build tools and of course, acquire soft skills like communication, project managing, project organization etc. These are the skills and techniques that will take you very far and the sooner you learn them, the better.

Also, if you have the chance to go to a JavaScript workshop, local event or conference, just go. I've always found these events really inspiring and motivating. Meeting new people, with the same interest, chatting and sharing experience, will greatly benefit you in the longer run.

Embracing the "never stop learning" philosophy

Now that you have a solid foundation and you are building cool projects, we have to tackle the next problem - how to stay relevant in one of the fastest changing industries in the world. Something that worked great for me was building a "never-ending flow of information". The "flow" can be anything - newsletters, videos, online courses or even in-person training as long as you do it occasionally. Here is what I'm doing.

I'm subscribed to several newsletters - JSK Daily, Frontend Buzz, JavaScript Weekly, JavaScript World, Hashnode Times to name a few, so I get new articles and resources almost every day. I read them after work or when I do my Pomodoro pauses. I save the most interesting articles and project in a Trello board or a GitHub repo. If something wins my interest (async await for example), I start playing with it on the weekends. I read about it, try a simple demo and experiment further. I don't set deadlines, so I can stop every time I want. It's one of the best ways to learn a new technology or specification. Building toy projects can also get you out of a burnout.

This can be done with videos and online tutorials too, as long as you make it a routine.

How to handle frustration and anxiety

Every developer, regardless of number of years of experience, goes through periods of frustration and anxiety. This is because the nature of programming is frustrating - you try to solve something and you don't know how. Then you get frustrated, try harder, step back, have an epiphany and eventually get your program to work. Getting frustrated is absolutely normal. The anxiety and frustration will never go. It will just make solving the problem more satisfying. You need to get comfortable working through that frustrating feeling.

When you feel you are burned out, take a break. Find a non-tech hobby, start exercising, spend time with friends or take a vacation. Do something different for a few days and then get back. You will be way more energised and motivated. I've gone through several burnout phases and taking time away from the computers always does wonders.

What I learned on the way

There are three major things that I learned through my journey :

This may seem trivial, but it's actually pretty important. Knowing how to ask the right questions can greatly optimize your workflow. Always try to ask direct and to the point questions like "get the file extension from a string in javascript" or "how do JavaScript closures work". Don't blindly trust the first solution you find. Question everything. Research a bit more, find different solutions and compare them.

Learned how and when to ask

Asking questions is probably the hardest thing for a beginner. You are exposing your ignorance, which in most cases feels humiliating. Or at least that's how I felt in my early days. Well, guess what... I was wrong. Not knowing something is absolutely normal and asking a question is the most reasonable thing to do. The rule I use is - if I can't make it in 20 minutes, I ask a question or search for it. You will be amazed by the number people who are ready to help you. :)

On helping others

When you learn enough, the best thing you can do is share, and by sharing I mean helping others. Find a community (Hashnode or Stack Overflow for example) and help other developers. Teaching others will not only offer you a pleasant feeling of achieving something meaningful, but also help you brush up some old material or technology you are interested in. It's never too late to help a fellow programmer.

Conclusion

Learning JavaScript and programming in general is not the easiest thing, but is surely worth it. It's hard, really hard and requires a great degree of dedication and perseverance. But having the right mindset, combined with the right resources, you can achieve superb results. Whatever you do, don't forget that programming should and can be fun.