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

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
1 months ago By 尊渡假赌尊渡假赌尊渡假赌

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)

How do I create and publish my own JavaScript libraries? How do I create and publish my own JavaScript libraries? Mar 18, 2025 pm 03:12 PM

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

How do I optimize JavaScript code for performance in the browser? How do I optimize JavaScript code for performance in the browser? Mar 18, 2025 pm 03:14 PM

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

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...

How do I debug JavaScript code effectively using browser developer tools? How do I debug JavaScript code effectively using browser developer tools? Mar 18, 2025 pm 03:16 PM

The article discusses effective JavaScript debugging using browser developer tools, focusing on setting breakpoints, using the console, and analyzing performance.

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 do I use source maps to debug minified JavaScript code? How do I use source maps to debug minified JavaScript code? Mar 18, 2025 pm 03:17 PM

The article explains how to use source maps to debug minified JavaScript by mapping it back to the original code. It discusses enabling source maps, setting breakpoints, and using tools like Chrome DevTools and Webpack.

Getting Started With Chart.js: Pie, Doughnut, and Bubble Charts Getting Started With Chart.js: Pie, Doughnut, and Bubble Charts Mar 15, 2025 am 09:19 AM

This tutorial will explain how to create pie, ring, and bubble charts using Chart.js. Previously, we have learned four chart types of Chart.js: line chart and bar chart (tutorial 2), as well as radar chart and polar region chart (tutorial 3). Create pie and ring charts Pie charts and ring charts are ideal for showing the proportions of a whole that is divided into different parts. For example, a pie chart can be used to show the percentage of male lions, female lions and young lions in a safari, or the percentage of votes that different candidates receive in the election. Pie charts are only suitable for comparing single parameters or datasets. It should be noted that the pie chart cannot draw entities with zero value because the angle of the fan in the pie chart depends on the numerical size of the data point. This means any entity with zero proportion

TypeScript for Beginners, Part 2: Basic Data Types TypeScript for Beginners, Part 2: Basic Data Types Mar 19, 2025 am 09:10 AM

Once you have mastered the entry-level TypeScript tutorial, you should be able to write your own code in an IDE that supports TypeScript and compile it into JavaScript. This tutorial will dive into various data types in TypeScript. JavaScript has seven data types: Null, Undefined, Boolean, Number, String, Symbol (introduced by ES6) and Object. TypeScript defines more types on this basis, and this tutorial will cover all of them in detail. Null data type Like JavaScript, null in TypeScript

See all articles