Home >Web Front-end >JS Tutorial >Summary of experience using JS

Summary of experience using JS

php中世界最好的语言
php中世界最好的语言Original
2018-04-23 10:04:321275browse

This time I will bring you a summary of my experience in using JS, what are the precautions when using JS, the following is a practical case, let's take a look.

In view of the fact that from time to time, some students send me private messages asking me how to learn front-end.

I will reply here uniformly. If I encounter a classmate who asks me this question again 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 is not enough.
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 goes 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. Personally I think it’s good, you can read it if you have nothing to do. The books are as follows:

>"javascriptObject-Oriented Programming Guide", the style is easy to understand, more suitable for beginners, prototypes My son explained it thoroughly, there are 12 inheritance methods.

>"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 book. Come and 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.

>"jsDesign Pattern and Development Practice" js design pattern also needs to be learned. This book explains the js design pattern very clearly, not at all It's obscure and doesn't seem to be very difficult.

>"Regularity Guidelines", when analyzing the source code, if regular expressions do not understand, you will not 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, it is very important that functions are first-class citizens.

> "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 become a world master. level. 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 lists 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.

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

> "The Definitive Guide to CSS", which explains the basic knowledge of CSS very clearly. What is the cascading priority, line-height and so on. 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 fully explain the various properties of CSS3. 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 think many students want to read, 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", it was like this. 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 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 feel that

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 typing process 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 have 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 a matter of 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, as mentioned at the beginning of the article, is 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.

>Someone asked me about my front-end work experience.

In just a few years. More than three years.

>What should I do if I am a beginner?

Reading books and analyzing source code are important ways to improve, but they are not suitable for novices.
What novices need is to be able to quickly get started and enter the industry, and to be able to start working quickly.
A quick way to learn is to watch videos. As some students said, you just need to know what things are there and how to use them.

Watching videos is beneficial. First of all, it is a passive learning method.
I also got started by watching videos, just watch them.
I didn’t understand it the first time, so when I played it again, I basically watched it at 1.5 times.
Reading is an active way, and you need to turn page by page by yourself. You need to take the initiative to understand.
And many things may be highlighted by just one sentence from the video teacher, and we need to interpret them ourselves.
Another thing is that if you find that you are not clear about a certain knowledge point, you can go to Baidu alone.
For example, this has many articles. This learning method is also a good way to quickly master knowledge points.

Books require technical review, so be sure to read the comments when reading articles. But it’s hard to say about videos. Videos usually don’t go into too much depth, and occasionally they make mistakes.
I was also misled by some videos back then, so I suggest you look for good videos and watch them. There are quite a lot of free videos from training institutions on major websites.

>Time to read books and analyze source codeBut when you have been working for a year and a half, it is a good time to improve, and you can read books at this time. Comprehensively and systematically sort out knowledge points and clear up your own blind spots.
If just relying on project experience is not enough, learning through projects is definitely necessary. The work itself is a learning process.
But if you don’t read books after working for three years, how much can you learn by studying? What's more, every project is very similar and always in the comfort zone. It's really like repeating the first year of 5 years of experience.
So I don’t agree with this sentence: Emphasizing one’s learning ability during an interview is a sign of poor work ability.
It is entirely possible for a person with 3 years of experience to have more than 5 years of experience.

>Don’t have time to study?

If you haven’t graduated yet, you are already hanging out on this site every day. In fact, you are a big step ahead.
They all went to college. Every day is filled with the company of lol and TV series. I just want to say that you have to pay back when you enter society.
What is the scariest thing? It's time to pay it back, and it's time to pay it back (don't pronounce these words wrongly). There is time, it just depends on whether you are willing to devote it.
Study after get off work, study on weekends, and code at home when others are playing during holidays. Only in this way can we stay ahead of others.

> Interested questions?

Interest and expertise are a virtuous iterative cycle. The more you are good at something, the more you will like it, the more you like it, the more willing you are to spend time on it, and the better at it.
We all understand this, but we just lack a trigger. If you like playing games, you may actually be very suitable for front-end work.
Playing games is a feedback mechanism. Feedback from front-end work is also very timely compared to other work. As soon as the code is changed and the web page is refreshed, the effect will be seen.
Good at, superiority, and accomplishment are usually connected together. Every time I finish a book, I feel a sense of accomplishment. Every time I complete a library, I feel a sense of accomplishment.

The above is purely a personal opinion. Everyone’s learning habits, methods, and attitudes are different. First correct your attitude, find your own learning method, and then develop the habit of persisting.
Finally, you and I encourage each other: as long as you are walking on the right path, no matter how slow you go, you are always moving forward!

I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to other related articles on the php Chinese website!

Recommended reading:

Using JS thinking skills

Detailed explanation of JS debugging

JS sends json format POST request implementation steps

The above is the detailed content of Summary of experience using JS. 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
Previous article:Use JS thinking skillsNext article:Use JS thinking skills