Home  >  Article  >  Web Front-end  >  [Transfer] Javascript gains from going to Baidu interview_javascript skills

[Transfer] Javascript gains from going to Baidu interview_javascript skills

WBOY
WBOYOriginal
2016-05-16 18:54:011094browse

This is a question that I remember, and I basically haven’t answered it yet. As everyone knows, I can’t help you guys anymore

1. Class inheritance in js is generally a mixture of class copying and prototype inheritance. The extend of extjs is a mixture of these two methods
But the examiner asked me, doesn’t this also add a reference to the parent class function in the subclass? (The superClass attribute will be added to the subclass.) Isn’t this also pollution? , how to do it better, I was asked stupidly
Can I add div to the 2.p element? Why not? I have never thought about this question
I found the answer to this
No, I Tried


[Ctrl A Select all Note: If you need to introduce external Js, you need to refresh to execute ]

Parse under ie6 and ff3 See it is parsed into 3 elements p div p
Look at the explanation of p
p is a block_level element
There are no other block-level elements that can be involved in p


3. As we all know, DomContentLoad is generally used in IE to add a script and use defer (ext implementation method) or use document.documentElement.doScroll() until no error is reported (jquery implementation method). Use it under ff DOMContentload event
But the problem is that when your DOM number is very large, DOMContentLoad will fail and not be executed. I have never thought about it.
My answer is that I copied the homepage of Sina and removed all the scripts, added domcontentload at the lowest level, and executed
The homepage of Sina is complicated enough and it still works. This problem will not happen
This can only be viewed under ff
http://124.42.34.97/Noname2.html


4. Animation is usually setTimeout/setInterval. When there are multiple concurrent operations, it is usually clear. The question is, when you clear it, it is the timestamp, but whether the function you called has been cleared. Well, I think it will be cleared (it has never been Never thought about this problem).

5. The difference between weird mode and traditional mode. This is usually done in xhtml mode. I really don’t know much about this
In weird mode, the width of ie = width padding margin, xhtml mode = width
You will know this , everyone disagreed, thank you from now on, learn the semantics of

6.html elements, I don’t see this very much, in fact, I haven’t seen it at all, haha ​​

7. Regularity, At that time, I asked about the difference between (?=)(?:)
I have always used (?=) but never used (?:)
Now I know
"ab".match(/a(?= b)/) print a
"ab".match(/a(?:b)/) print ab
haha
It’s also a performance issue when writing regular expressions
To be honest, it’s really I haven’t gone through it first. I used to want to be able to write clearly and concisely, but I never thought about performance.

8. Floating. Generally, I remove floating and just add a
< /div>, but this adds an extra div. How can I avoid adding extra divs? Do I write clear:left/right directly in the next div?
My answer

[Ctrl A Select all Note: If you need to introduce external Js, you need to refresh to execute ]

9. Except under table Is tbody the element that follows? Are there other elements?
My answer is thead, tfoot, tbody

The most disappointing thing is that I couldn’t see the moon shadow (you can only see it on the 3rd side), but the gain is also Quite a few, I know many of my own shortcomings and gain more than I lose.
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