DEV Community

Cover image for How to learn Javascript easily
Serhii
Serhii

Posted on • Originally published at metacognitive.me

How to learn Javascript easily

tl;dr search for "learn javascript theory" in Google and pick any website. Go repeat what they teach in Codepen. Repeat for every theory section.

So you're prepared to learn something exciting! The first thing you need: a theory on how those things work. Only basic things such as syntax and programming fundamentals. Like what? Understand why do we need programming it at all. What things are possible, what aren't

Step 0. A place where to write and execute code. To see the result of your code. Go to Codepen and create a pen. Or choose another code editor. This is where you'll be writing programs while studying.

Step 1. Choose any website where you can learn about the language syntax. Google "javascript tutorial", "learn js" and so. The source doesn't matter at this point, pick any.

This is a great resource.

Get familiar with how to write code:

  • how to create a variable;
  • how to make a function;
  • how to call a function;
  • how to read function arguments, handle them, and return something useful;

Congrats on this milestone! You now can write basic code. Note that it isn't so straightforward to write it though in the beginning. It's okay you can't follow tutorials. Try to write basic things. Get used to the style and then go further.

Don't go to the next step until you code the practice tasks in the tutorials you followed. It's important! Don't skip the tasks!

Step 2. Learn about data structures and when to use them. There are primitive structures such as numbers, strings, booleans. And there are more complex types such as arrays, objects. You should:

  • understand when to use arrays and objects;
  • know the difference between the two;
  • write a lot of code using various data structures;

Don't go further if you aren't comfortable with writing Javascript code. Functions, operations with objects, arrays. If you don't understand some part, it's okay and it doesn't mean you're dumb. I was trying to learn to code a lot of times and it was hard. Go back and read the theory, then solve the practical tasks. If you can't deal with them, go to Stackoverflow and see solutions. Understand how they work.

Most of the time if you don't understand something, it's because you skipped a section. Or, didn't read it carefully. Or, the information isn't simple enough. Try following a different source. See a video tutorial. Still, finding it difficult? Write me.

Step 3. Deciding your niche in applying Javascript. With JS, you can program:

  • front-ends(interactive visual representation). It's websites with logic. You need HTML, CSS to create visual blocks and JS to say a browser what to do. For example, when you press a button, JS handles the press and does something useful. Sends your data to a server to save in a database;
  • back-ends(server-side code: Node.JS). This is where you can handle the data a website sends you. Store it in a database, or send it somewhere else. Or, transform it and save it;
  • mobile apps. With React Native framework you can do such, isn't that cool?
  • desktop apps;

Step 4. When you decide what path you want to take, learn the specifics of that environment.
For browsers(front-end path) you need to learn DOM. I.e. how to interact with visual elements on a website page. Think what projects you'd want to create - a personal website, an online store. Or something else. And create it! Make only a super simple and tiny version. Find a theory you will need when you encounter unknowns. E.g. how to find all buttons on a page and handle clicks on every one of them.

If you prefer server-side coding, you should learn Node.JS. It's a thing that helps you to run Javascript in a server-side environment. Learn how to:

  • create a basic HTTP server;
  • handle the HTTP requests. E.g. when calling GET /api/hello to return "Hi!";Then practice. Pick up the Express library. It simplifies creating code on a server. Make some HTTP routes, do some transformations of data you receive.

And, of course, create an interesting project! A server for an online store website? A Discord bot?

For mobile and desktop apps, the strategy is the same. Learn specifics about the frameworks(React Native for mobiles or Electron for desktops). Create pet projects.

Summary

The most important thing in learning Javascript fast enough is to practice a lot. Don't skip it. Thus you learn applicable things that solidify what you've been reading a lot.

Focus on one area. Solidify your knowledge in one niche, then go further after understanding the basics.

Follow me on Twitter

Top comments (0)