Record a poor experience (front-end)

Source: Internet
Author: User

In JavaScript, there are two classes A and B, so that Class B inherits all the attributes of Class. After hearing the description, I thought it was very simple, so I directly knocked on the code in firebug. The guy said to me: console. log out, so I am decisive console. dir, the result is 1-1, adjusted, added the parameter, for apply... I don't know what to do on the spot .....


Figure 1-1

Even worse, I suspected myself at the time and did not change console. log, alert, even document. write. When I came back, I thought it was wrong. So I tested it and found the problem. Next I went to 1-2:


Figure 1-2

If no problem is found, you can directly use console. dir (obj) to display the attributes of this object. However, console. dir (obj. name) prompts that there are no sub-objects. It means that the problem is not in the code, just change chrome and try again, 1-3.


Figure 1-3

In this case, console. dir (obj. name) will get the expected result, which is correct.

There was a great god in the garden before:

9 offer, 12 companies, 35 interviews, from Microsoft to Google, the path to 2012 job hunting for new computer graduates

What the great gods said: they have encountered a variety of non-professional flash sales and various proprietary tricks. So how can I explain this self-help plan? Let's extract some quotations from this great God:

My Microsoft mentor once mentioned that my internship interview performance was average, but later I showed much higher hands-on skills than I had previously estimated. Some of my interviews were outstanding, and I answered a few questions, it is not ideal after I start the job, at least not as good as what I offered during the interview.

This indicates a problem, that isFor a written test interview, preparation and not preparation are very different.If your resume is not so NB, you can only rely on the test and interview for extra points. Some people around me often wonder why I cannot write such code in MS. The answer is often simple: people have prepared more than you for a month. Writing a program on a computer may be very helpful. You will know what it is called a self-help plan when you try to write it on paper during a written test interview.

These things are quite thorough, so we will not discuss them much. Simply follow the technology, and proceed with the problem. When talking with the "this degree" interviewer, the other party answered the question by using the JavaScript prototype chain. When I heard this sentence, I was shocked, but they are also right. Besides, they all say that their js is not good. It is an artist's birth. It is estimated that the buddy has a lot of doubts about me. Alas .....).

1-3: prototype is directly used. The results of the prototype chain method still do not get the expected results. It seems that the bug of firebug is hard to "fight" to the end.


Figure 1-3

Change chrome, 1-4:


Figure 1-4

At this time, console. dir (obj. name) will get the expected result. Of course, the _ proto _ of B also points to. Okay, no matter what the firebug is, it's too "pitfall. Continue to use chrome to compare the differences between the two methods, 1-5:


Figure 1-5

In terms of prototype chain, Class B is no longer its own. It is just an "affiliated" on the prototype chain A. Its constructor points to, in this case, we can only write one class A. Why bother ourselves and pull out A Class B?

The original intention of this question is to let Class B inherit all the attributes of Class A, and my answer is correct. However, I did not expect firebug to be so weak. Back then, from this experience, the thought of the Buddy's investigation is correct: If you don't listen to what you say, you can use small details to explain the problem one by one. This method can avoid the situations where the previous Great God said that the pre-determination will not be abandoned, and filter out those who have poor hands-on capabilities but have a strong "Exam-taking" ability.

However, this "degree" buddy is too self-satisfied. I spoke with a very modest attitude throughout the process, and then he became more self-satisfied. I used the css he was good at to examine all kinds of small details. I came back and sorted out his questions. I had to admit that I had never been so careful before, but some details really made me despise this guy, he's confused.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.