Home Web Front-end JS Tutorial Take you out of the difficulties of learning javascript

Take you out of the difficulties of learning javascript

Dec 15, 2016 am 10:37 AM

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 on the HTML element. We will initially think that this is the method of binding the event.

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)!


Statement of this Website
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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1655
14
PHP Tutorial
1252
29
C# Tutorial
1226
24
What should I do if I encounter garbled code printing for front-end thermal paper receipts? What should I do if I encounter garbled code printing for front-end thermal paper receipts? Apr 04, 2025 pm 02:42 PM

Frequently Asked Questions and Solutions for Front-end Thermal Paper Ticket Printing In Front-end Development, Ticket Printing is a common requirement. However, many developers are implementing...

Demystifying JavaScript: What It Does and Why It Matters Demystifying JavaScript: What It Does and Why It Matters Apr 09, 2025 am 12:07 AM

JavaScript is the cornerstone of modern web development, and its main functions include event-driven programming, dynamic content generation and asynchronous programming. 1) Event-driven programming allows web pages to change dynamically according to user operations. 2) Dynamic content generation allows page content to be adjusted according to conditions. 3) Asynchronous programming ensures that the user interface is not blocked. JavaScript is widely used in web interaction, single-page application and server-side development, greatly improving the flexibility of user experience and cross-platform development.

Who gets paid more Python or JavaScript? Who gets paid more Python or JavaScript? Apr 04, 2025 am 12:09 AM

There is no absolute salary for Python and JavaScript developers, depending on skills and industry needs. 1. Python may be paid more in data science and machine learning. 2. JavaScript has great demand in front-end and full-stack development, and its salary is also considerable. 3. Influencing factors include experience, geographical location, company size and specific skills.

How to achieve parallax scrolling and element animation effects, like Shiseido's official website?
or:
How can we achieve the animation effect accompanied by page scrolling like Shiseido's official website? How to achieve parallax scrolling and element animation effects, like Shiseido's official website? or: How can we achieve the animation effect accompanied by page scrolling like Shiseido's official website? Apr 04, 2025 pm 05:36 PM

Discussion on the realization of parallax scrolling and element animation effects in this article will explore how to achieve similar to Shiseido official website (https://www.shiseido.co.jp/sb/wonderland/)...

The Evolution of JavaScript: Current Trends and Future Prospects The Evolution of JavaScript: Current Trends and Future Prospects Apr 10, 2025 am 09:33 AM

The latest trends in JavaScript include the rise of TypeScript, the popularity of modern frameworks and libraries, and the application of WebAssembly. Future prospects cover more powerful type systems, the development of server-side JavaScript, the expansion of artificial intelligence and machine learning, and the potential of IoT and edge computing.

How to merge array elements with the same ID into one object using JavaScript? How to merge array elements with the same ID into one object using JavaScript? Apr 04, 2025 pm 05:09 PM

How to merge array elements with the same ID into one object in JavaScript? When processing data, we often encounter the need to have the same ID...

JavaScript Engines: Comparing Implementations JavaScript Engines: Comparing Implementations Apr 13, 2025 am 12:05 AM

Different JavaScript engines have different effects when parsing and executing JavaScript code, because the implementation principles and optimization strategies of each engine differ. 1. Lexical analysis: convert source code into lexical unit. 2. Grammar analysis: Generate an abstract syntax tree. 3. Optimization and compilation: Generate machine code through the JIT compiler. 4. Execute: Run the machine code. V8 engine optimizes through instant compilation and hidden class, SpiderMonkey uses a type inference system, resulting in different performance performance on the same code.

How to implement panel drag and drop adjustment function similar to VSCode in front-end development? How to implement panel drag and drop adjustment function similar to VSCode in front-end development? Apr 04, 2025 pm 02:06 PM

Explore the implementation of panel drag and drop adjustment function similar to VSCode in the front-end. In front-end development, how to implement VSCode similar to VSCode...

See all articles