Home  >  Article  >  Web Front-end  >  The empirical path to learning JavaScript

The empirical path to learning JavaScript

巴扎黑
巴扎黑Original
2017-08-04 13:19:201021browse

This article mainly introduces how to learn JavaScript? The experience of seniors, that is, how to learn front-end, has certain reference value. Interested friends can refer to it

Since from time to time, some students send me private messages asking me how to learn front-end.
Here is a unified reply. If I encounter a classmate who asks me this question next time, I will directly send you the link address of this article.

First of all, let me digress. About someone calling me a great god.
Personally, I feel like this is the same as when someone calls you a handsome guy when you are shopping. It doesn’t matter whether you agree or not.

Let’s start with the topic. How to learn the front-end should vary from person to person. Others’ methods may not be suitable for you.
Let’s talk about my learning method.
I spend most of my time learning js. Because the learning curve of this js is flat at first and then steep.
I won’t talk about project practice and exercises, but mainly talk about the use of time outside of work.
How did I learn? Reading books and analyzing source code.
I have made statistics in the past few days and I have read more than 50 front-end books so far. Most of them are js. I have read almost all the books on the market.

The first question is, What are the benefits of reading?
The benefits should be self-evident. If you read too many books, the foundation will gradually be solidified.
After seeing too much, your own judgment will naturally improve.
Reading other people's articles, you can quickly judge whether each part of what the other person said is correct or not, and which part is unclear or ambiguous to you.
Of course, it also provides a basis for looking at the source code and analyzing the source code.

The benefits of reading 10 books twice should be greater than reading one book 20 times.
The intersection of 10 books is the core of basic knowledge, and the union is all knowledge.
Of course, good books should be read more and repeated. But reading just one book won’t do.
Because the focus of each book is different. It is very meaningful to understand a knowledge point from different aspects.
So I particularly admire Indians. When they speak English to you, if you don’t understand a word, they will pop up n words with the same meaning. If you understand one, it’s OK.
The same is true for reading books. If you don’t explain a certain part thoroughly, don’t worry, other books can help you understand.

The second question is, book recommendations.
I personally think it’s good, you can read it if you have nothing to do. The books are as follows:

> "Javascript Object-Oriented Programming Guide", the style is easy to understand, more suitable for beginners, the prototype is thoroughly explained, and the 12 inheritance methods Woolen cloth.

##>"JS Authoritative Guide" and "JS Advanced Programming", these two books are classics, but they are too thick. It is suitable to regard any one chapter as a A book to read. It's so eloquent that it's hard to read it all in one sitting. More suitable as a reference book.

>"JavaScript You Don't Know" focuses on the core details of js, including closures, prototypes, and this. The "Second Volume" is now out, and I'm still reading it.

> "JS Design Patterns and Development Practices" JS design patterns also need to be learned. This book explains the JS design patterns very clearly and is not obscure at all. Read It's not that difficult to get up.

> "Regularity Guidelines", when analyzing source code, if you don't understand the regular expressions, you won't be able to proceed. This book is relatively clear.

>After reading "JavaScript Web Rich Application Development Based on MVC", you can basically write your own MVC framework. It's a good book.

>"Javascript Functional Programming", js is a functional language, this book is an introduction to functional programming, functions are first-class citizens, that is very important of.

> "JS Ninja Secrets", written by the author jq, is not as difficult to read as the legend says. Even if you read and understand all the knowledge points, you will not be able to read it. Reaching the level of a world expert. Because you haven't done whatever you want.

>"Javascript Framework Design", if you read this book for the first time, you will feel that this book is a list of codes. In my opinion, this book focuses on the overall view of the framework.

I think the above books are must-reads on the road to becoming a master, and they need to be read again and again.

To be honest, I have read relatively few books related to css, maybe six or seven in total. There are two books that I must recommend:


> "The Authoritative Guide to CSS", which explains the basic knowledge of CSS very clearly. What are the stacking priorities, line-height, etc. Not just any book can be called the "definitive guide".

> I keep reading the book "CSS Revealed", but this book doesn't even bother to talk about the various properties of CSS3 in a comprehensive way. What the CSS specification document can talk about, it will only talk about what you least care about. The 47 problems solved in this book are equally important as the solutions and are very inspiring. You don’t have to buy any of the above books, at least buy this book.

The third question, how to look at it.

I believe that many students want to read books, but it is difficult to continue.
The text part is relatively easy to read, but when I encounter the code, my scalp becomes numb.
I also encountered this problem at the beginning.

Tell me a learning theory.
For example, when learning English, there is a boiling water theory.
The vocabulary must reach 6000. If it is not reached, the English level will not improve.
This is the same as boiling water. It is okay to boil it and let it cool. It has never been boiled to 100 degrees, so this water is Never drink it.
Once boiled, you can drink it at any time.

20 If you can’t stand this book, what does it mean?

You have never finished any book. What is familiar is always only the first three chapters. Don't laugh, I used to be like this too.
Then the question now is, how to finish reading a book?
Very simple, knock.
When I read the book "JavaScript Web Rich Application Development Based on MVC", that was it. Finally one day, I made up my mind to read this book from beginning to end.
Type the text and code, and then you have to read chapter by chapter. After typing the code, you will find that it is not as difficult as it seemed before.
If you are the kind of student who gets sleepy when reading a book. It is strongly recommended that you read the book "JavaScript Object-Oriented Programming Guide" from beginning to end.
After persevering in reading a book, my confidence will rise. Make sure you finish reading one first. After reading three books, you should be able to read one in a few days. Everything is difficult at the beginning, so go for it.

The fourth question is the level of reading.
#After reading the book, you should summarize it yourself and compare it with other books. Some students read "The Authoritative Guide" and "High Design" at the same time.
Take out any knowledge point and you can explain it clearly and logically with your eyes closed, which means your level is sufficient.

The next step is to learn the source code.
Before looking at the source code of the framework, I want to say one thing: If you don’t understand the dom API, no problem, you can use Baidu. But the rules must be studied first.

Otherwise, this is where most people encounter frustration when trying to analyze the source code.



How to read the source code?

Knock, keep knocking.

What codes are worth knocking? The source code of excellent frameworks or libraries is worth checking out.

But using jq to knock on and get started, that won’t work. Reason: Too damn long. Eight or nine thousand lines! !


Personally, I think

underscore.js library

is a good first choice. The reasons are all tools and methods. After finishing the knocking, my level should be slightly improved. In fact, there are some API implementations. You should treat it like getElementById and imprint it deeply in your mind. For example, the extend method must be used with open mouth. After finishing the underscore library, you can consider reading the book "Javascript Functional Programming".
The source code of jq is not easy to type. Then the source code of

zepto

is less than 1800 lines, which should be completed in one day. After typing a few times, Baidu will clarify all the things you don’t understand, and then you can write your own jq-like library. Then you can write it as a skill in your resume. For example, "I have created my own jquery library". Of course, the process of typing can also help you understand jq’s API.

Then

backbone.js

, because this framework is an mvc framework based on classes jq and underscore. There are not many lines of code. Knock it on. spine.js is similar to backbone. Before knocking on it, you can first read the book "JavaScript Web Rich Application Development Based on MVC". I hope you can add this to your resume, "Created your own MVC framework."
I also knocked on some others. Includes jq.validate.js, including some plugins.
If you want, you can knock on bootstrap. There is a lot of source code, you can type it one by one according to the plug-in.

The analysis makes it clear that plug-ins for carousels, paging, drop-down boxes, etc. cannot be written casually in minutes.

At least it would be great to see how other people’s API interfaces are designed. By the way, I also learned a lot from reading its css code.
Speaking of plug-ins, there are two that must be mentioned, one is the table plug-in and the other is the tree. After finishing all the typing, you can write in your resume, "Created my own UI framework."

Of course, you can also type the framework code you like. The important thing is to understand its implementation principle. It is best to understand why it is designed as it is. If you are familiar with design patterns, you will often find that it is like this. Something happened. . .
Following it is just an introduction to source code analysis. It is also used for learning. Finally, if you can use it in your own projects, that is the right way.

Even if it is useless, it is still a good way to kill time, much better than watching TV series. When I was free and bored, I typed the underscore source code behind my back.


Finally, if you can write those few sentences on your resume as expected, you must be a great person. Come on.

Postscript: The original purpose of writing this article is, as mentioned at the beginning of the article, to facilitate my reply to everyone’s questions.
Any article on this site that shares learning experience will basically resonate. This is indeed a topic worth discussing.
Let’s talk about a few more things here.

The above is the detailed content of The empirical path to learning 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