There will be difficulties in learning any knowledge. Of course, learning JavaScript is the same. This article summarizes some of the difficulties in learning Javascript and explains each difficulty:
First, use systematic knowledge to make the problem concrete
We often do this when learning Discover that the same problem can be solved in different ways. For example, to bind a click event to an element, you can use
When we see for the second time that we can pass a function to an event to bind: a.onclick=f1; then we will think that there is more than one way to bind an event.
When we see the addachEvent("onclick",f1) method used to bind events for the third time, you will definitely think that there may be more than three ways to bind events. And there is no reason to use three identical methods to do one thing. There must be some differences between them?
So what are the differences between them? How many ways are there to bind events? When you find that a method is incompatible in IE, you still ask why? Is my grammar wrong? Or what happened. After answering questions one after another, you have to ask yourself: "Oh my god! When will I learn JavaScript well?!".
Maybe it will be difficult for you to learn JS well if this continues. In fact, I want to tell you that you are not far away from learning from him, but you just don’t know how. What's the reason? The reason is that there is no systematic knowledge. The reason is that I have not read the "JavaScript Definitive Guide". He will tell you that there are four methods for binding events, and two of them are basic methods. All browsers support them, and there are two more. Advanced methods, one is the W3C standard method, and the other is the IE standard method, so you know why IE is not compatible with one of the advanced methods, right?
Now that things are concrete, you only need to consider these four methods when binding an event, and you will no longer have so many doubts. You will also feel that you understand the event, and you should next understand other issues. You will also feel that you have finally made progress in JS. Of course, you will also feel that you have come out of a dilemma.
2. You must understand the history of JavaScript
Do you understand the history of JS? Of course I understand that it was not originally called JavaScript, and it was not first implemented in IE. Yes, it’s very well said, but it’s not the most important thing. Knowing this will not make you a master. You must understand it in more detail, and mainly understand the history of functional evolution.
Like the above, why are there so many methods for binding events? Why are there so many ways to get an element? Is document.links[] more formal? Or is getElementsByTagName('a') more formal? Which one has better compatibility? How many such methods are there?
You must know that one question is enough to give you a headache, ten questions will make you unable to start, and a hundred questions will make you doubt yourself. A thousand questions finally come back to the question "Oh my God! When can I learn JavaScript well?" Haha, that's often the case. The solution is to concretize it and understand how many methods there are and why there are these methods. There must be answers to these questions, because JS is not something left by aliens, it was created by humans, and that person's thinking is also limited, right?
When you know that document.links[] is a legacy document method, and there are a total of 5 such legacy methods. Some problems disappear when they are anchors[], applets[], forms[], images[], links[]. When you also know that the DOM standard retains them, and you also know that all browsers support them, you Also knowing that they are the so-called "Level 0 DOM" you will get out of another "dilemma".
3. JS has a crisscrossed knowledge structure
The knowledge structure of JS is crisscrossed horizontally and vertically, which makes it more difficult to understand it. You must have a clear understanding of this. Let’s explain “crisscrossing” below.
General knowledge has a horizontal nature. For example, from a large perspective, JS is divided into core part and client part. This is horizontal. The core part is divided into lexical structures, data types and values, variables, expressions and operators, statements, objects and arrays, functions, classes, modules and namespaces, and regular expressions. This is also horizontal.
The client part can be divided into BOM, DOM, events, styles, forms, etc. These are also horizontal knowledge structures.
A technology rarely uses time as a structure, but because the development of browsers is dynamic, browsers in different periods have different degrees of implementation of JS, and web pages written for the browsers at that time at different times cannot be changed because of technology The development of JS should not be considered, and it is impossible for all websites to be rewritten with the development of technology. Therefore, JS must be developed and upgraded while retaining forward support. Therefore, even if there is a better method, the previous method must be retained. There are many legacy JS properties and methods. For example, the "Level 0 DOM" has been retained in the new W3CDOM. To a certain extent, it is vertical of.
When I have a clear understanding of the knowledge structure, one advantage is that when I want to solve a problem, I can know which piece of knowledge I want to use. For example, if you want to get the position of an element in the document, you will know to use the attributes of the element in the DOM. If you want to get the position of the mouse pointer, you will use the attributes of the event object. To obtain a reference to an element, you can use the legacy DOM or the W3C standard DOM method. This is a good thing.
In fact, the core of the above question is systematization and concreteness. This is a point that I think is very important in the learning process. This really solved a lot of doubts for me.
Any knowledge and technology is the same. As long as you have studied the whole system systematically, the problems you encounter will be slowly solved and you will understand more deeply.
The above is the content that will take you out of the difficult points of learning javascript, and more For more related articles, please pay attention to the PHP Chinese website (www.php.cn)!

Detailed explanation of JavaScript string replacement method and FAQ This article will explore two ways to replace string characters in JavaScript: internal JavaScript code and internal HTML for web pages. Replace string inside JavaScript code The most direct way is to use the replace() method: str = str.replace("find","replace"); This method replaces only the first match. To replace all matches, use a regular expression and add the global flag g: str = str.replace(/fi

So here you are, ready to learn all about this thing called AJAX. But, what exactly is it? The term AJAX refers to a loose grouping of technologies that are used to create dynamic, interactive web content. The term AJAX, originally coined by Jesse J

10 fun jQuery game plugins to make your website more attractive and enhance user stickiness! While Flash is still the best software for developing casual web games, jQuery can also create surprising effects, and while not comparable to pure action Flash games, in some cases you can also have unexpected fun in your browser. jQuery tic toe game The "Hello world" of game programming now has a jQuery version. Source code jQuery Crazy Word Composition Game This is a fill-in-the-blank game, and it can produce some weird results due to not knowing the context of the word. Source code jQuery mine sweeping game

Article discusses creating, publishing, and maintaining JavaScript libraries, focusing on planning, development, testing, documentation, and promotion strategies.

This tutorial demonstrates how to create a captivating parallax background effect using jQuery. We'll build a header banner with layered images that create a stunning visual depth. The updated plugin works with jQuery 1.6.4 and later. Download the

Matter.js is a 2D rigid body physics engine written in JavaScript. This library can help you easily simulate 2D physics in your browser. It provides many features, such as the ability to create rigid bodies and assign physical properties such as mass, area, or density. You can also simulate different types of collisions and forces, such as gravity friction. Matter.js supports all mainstream browsers. Additionally, it is suitable for mobile devices as it detects touches and is responsive. All of these features make it worth your time to learn how to use the engine, as this makes it easy to create a physics-based 2D game or simulation. In this tutorial, I will cover the basics of this library, including its installation and usage, and provide a

This article demonstrates how to automatically refresh a div's content every 5 seconds using jQuery and AJAX. The example fetches and displays the latest blog posts from an RSS feed, along with the last refresh timestamp. A loading image is optiona

The article discusses strategies for optimizing JavaScript performance in browsers, focusing on reducing execution time and minimizing impact on page load speed.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

SublimeText3 Chinese version
Chinese version, very easy to use

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

SublimeText3 Linux new version
SublimeText3 Linux latest version