Home >Web Front-end >JS Tutorial >Detailed explanation of 9 common errors in JavaScript

Detailed explanation of 9 common errors in JavaScript

黄舟
黄舟Original
2017-09-22 10:28:521254browse

This article mainly introduces the relevant information that hinders your progress in analyzing 9 common errors in javascript. I hope this article can help everyone. Friends in need can refer to

analyzing 9 common errors in javascript. Common mistakes that hinder your progress

Many people try to learn JavaScript, but give up soon after. Then they tell themselves, "JavaScript is too complicated," or even worse, "I'm not a front-end developer."

This situation is quite sad. In fact, you don’t have to give up at all, all you have to do is change to a different learning method.

In this article, we’ll cover some of the most common learning mistakes and learn how to avoid them. Many of the techniques apply not only to JavaScript, but even to web development, so that’s a bonus.

Let’s do it!

Mistake #1: Overanalyzing before you start learning

You can find a lot of relevant information before you start learning JavaScript. If you look, you'll find some information about which JavaScript is the best or the worst, and whether you need this framework or that framework. You may also hear that you need to write JavaScript a certain way or you'll never become a "real" developer, etc.

Whether this is true or not, there is nothing worse than wasting six months to a year without getting started.

Start typing code, it may not be perfect, it may be terrible. But if you get started, you've passed one of the hurdles that holds many people back.

Mistake #2: Learning native JavaScript before learning frameworks

JavaScript frameworks are built on top of native JavaScript, so if you understand JavaScript, you will naturally understand it. Basic principles of how to use any JavaScript framework.

However, if you learn a framework directly, you will end up just memorizing its syntax but not understanding its principles. It's like making sentences without knowing the meaning of the words. You end up memorizing some words randomly without knowing their meaning and not organizing the words to use them.

If you jump directly into a framework, it will be harder to learn, and when you need another framework you will have a harder time adapting. If you learn basic JavaScript first, you will have a solid foundation to understand all frameworks.

Mistake #3: Aiming Too High

One of the most common mistakes is taking action immediately after understanding a concept.

I've been struggling with this because once you understand something, you want to take it further.

It's helpful to treat each concept like a new toy; this means taking some time to enjoy what you've just learned. Play, experiment, and see if you can do something new. You'll learn a lot and you'll remember better.

When you feel that you can use it with your eyes closed, continue learning. It may take you a little more time before you get to this point, but it will make the rest of your learning faster.

On the other hand, if you are too impatient, you won’t pay much attention to details. But the frustrating thing is that this will greatly increase your subsequent learning costs. In fact, this is one of the common reasons why people often give up learning JavaScript.

Mistake #4: Not understanding the concept thoroughly

Learning is like climbing stairs: if you can take one step, you can keep taking more steps until you Achieve goals. When something is hard to understand, it's often because you want to take a leap rather than take it one step at a time. Of course this is wishful thinking!

In actual scenarios, when I see people don’t understand a certain piece of code, I will ask them to explain it, and they will try to explain the entire problem at once. Then I would ask them to explain it again line by line, so it makes sense.

If something is confusing, it's often because something was skipped, and this will also help you pay attention to the details until you figure out the crux. If a concept still doesn't make sense after breaking it down, you'll also have an easier time finding relevant solutions because it's easier to look up a specific topic than to search randomly.

Mistake #5: Trying complex projects too early

People who just start learning JavaScript often say, "I'll just set a small goal, like writing a Facebook website,” not realizing the depth involved in the project. As the project gets deeper, they give up on learning JavaScript.

I go into more detail about the project, but when learning, it's easier to start with some basic concepts. When you start working on a project, you can add some build tools to your toolkit.

To be more clear, I am not looking for a longer-lasting project. I've just discovered that if I do the easy parts first, like displaying some text in the browser or responding to a button, it makes it easier to get the project off the ground.

Mistake #6: Not practicing in a real-world environment

When you learn JavaScript, you may practice in a real-world environment. For example, you might be typing in the site's built-in code editor, or you might rely on pasting files from a tutorial.

These methods may be very good for learning, but you can also try to build the environment yourself. This means using your own text editor and writing the project from scratch.

If you don't practice each concept independently, you will be dependent on the training environment. You end up in a situation where you've spent a lot of time learning, but you can't master any of them.

Mistake #7: Comparing Yourself to the Great Ones

One of the easiest ways to make yourself more frustrated is to compare yourself to the Great Ones. Because you always look at where they are, not how they got there.

For example, people see my tutorials and ask me how I write such clean code. They say they can't write clean code like this, so maybe they're just not that good at JavaScript after all.

The truth is my process is a mess. I experimented, made mistakes, looked up resources, wrote ugly code, and finally refined everything into a presentable tutorial. People see the good version and assume that's what the process is all about. I also made these assumptions about tutorial authors until I started writing my own tutorials.

The key point is, study carefully what you are learning, and you will improve. Keep repeating this process and soon others will be wondering how you reached those heights.

Mistake #8: Watching tutorials without writing code

You will naturally spend a lot of time watching videos and tutorials, but unless you write code yourself, Otherwise you can't really learn.

It is very dangerous to just watch without taking actual action. You will have the illusion that you are learning. After six months, you realize you haven’t learned anything.

Writing 15 minutes of code is much more useful than just watching an hour-long tutorial.

Mistake #9: Blindly following tutorials without first understanding or trying them yourself

When reading tutorials, it’s easy to fall into copycat situations. This kind of tutorial does not teach you how to solve a problem, such as what kind of tests need to be performed, and how to explore the possible directions of the problem step by step. Therefore, people who only follow tutorials often fail to learn real knowledge.

So what is the solution?

Don’t just follow the tutorial step by step, but take some time to implement it yourself. For example, if you're following a slideshow tutorial, try showing and hiding p, then try timing, and then try another small section. Rather than following a step-by-step tutorial, you'll learn more and potentially apply it better by trying it out and branching out.

The above is the detailed content of Detailed explanation of 9 common errors in JavaScript. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn