A guide on how to easily learn Javascript
I'm writing this article to uncover some myths, truths, beliefs, and doubts. Being a newbie in a new domain is difficult. When starting coding it's not obvious what path you should take. There is a huge amount of technologies and even more articles (mis)directing you. So what path you should take when starting out?
If you want to get to the learning plan immediately, jump to the how to start section.
If you're:
- new to programming;
- you don't know what is the initial point to start;
- you don't know whether it's worth learning coding in general;
- or you have other related questions;
You may read my general programming FAQ.
Many of you learn Javascript from scratch. I can assure you don't have to have a CS degree or to be a genius. Is this possible? Of course. I'll provide the learning plan further. All you need for learning is a concentration, a computer, and an Internet connection.
Many of you want to learn Javascript fast. I can assure you it's simpler with a learning strategy, but ... It's not fast. It all depends on your dedication. Do you spend 10 minutes a day learning or 6 hours? Do you focus enough? So you're actually studying or getting distracted by notifications?Also, the theory isn't enough, so your learning will be continuing for a long time. It's when you get familiar with the subtleties of the language. But it doesn't mean you can't create projects after mastering fundamentals. You will, and you will be learning more and more.
The most important part of the article. To learn any programming language(or technology) you need to master the very basic theory. Then immediately go code something. Repeat with more complex theory. Only practice(to solidify theory) will get you far in studying something.
Why learn Javascript
In case you don't know what programming language to choose, please read this section.
It's a simple language to start with. You might also hear about Python, it's also a simple one to begin with. In case you're curious about picking Python or Javascript, then consider this.
- Python is also a great choice for beginners because it's simple too.
- The community is big enough. But if your goal is to develop web apps, then you better choose JS. Why? Browsers support Javascript by default. You can create a script, add some HTML, and a browser will show the result immediately. With Python, you almost can't code websites' UI(front-end). For this, you need to reinvent some wheels. E.g. use a Javascript package that converts Python code to JS. But you can code backends and other things in Python.
Javascript is a great choice to learn if you:
- want a simple language;
- want to get hired fast. A lot of job positions for JS developers out there;
- want to be a full-stack person. You can program for browsers(front-end). Servers(backend, Node.js). Mobiles(React Native and so). Desktops(Electron.js). Microcontrollers. You may do all that in other programming languages, of course. But JS has a large community. More details in the below point;
- want to have ready-made solutions. You don't need to code some algorithms by yourself in most cases. You don't need to do complex things only to draw a rectangle on a website. There are many packages, frameworks, and community support for you.
How to start with Javascript
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.
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.
This article is awesome and helpful.