Javascript gains from Baidu interviews

Source: Internet
Author: User

This is a question I remember. I haven't answered any questions. I can't help it anymore.

1. In js, class inheritance is generally used in combination with class transcription and prototype inheritance. In extend of extjs, these two methods are mixed.
But the examiner asked me, isn't this a reference to the parent class function added to the subclass? (the superClass attribute will be added to the subclass) Isn't this also a pollution, I was asked how to do better.
2. Can I add a div to the p element? Why? I never thought about this problem before.
I found the answer.
No, I tried it.
<! Doctype html public "-// W3C // dtd html 4.0 Transitional // EN"> <HTML> <HEAD> <TITLE> New Document </TITLE> <meta name = "Generator "CONTENT =" EditPlus "> <meta name =" Author "CONTENT =" "> <meta name =" Keywords "CONTENT =" "> <meta name =" Description "CONTENT = ""> </HEAD> <BODY> <p> </BODY> </HTML>
[Ctrl + A select all Note: If you need to introduce external Js, You need to refresh it to execute]
In ie6 and ff3, three elements are parsed: p div p.
I have read the explanations of p.
P is a block_level element.
No other block-level elements can be included in p.


3.domcontentload, in IE, The defer(ext documentdocumentdocument.doc umentElement. doScroll () is used all the time. No error is reported (implemented in jquery), and DOMContentload is used in ff.
But the problem is that when you have a very large number of dom, DOMContentLoad will not be invalid but will not be executed.
My answer: I copied the sina homepage to all the scripts, added domcontentload at the lowest level, and executed
Sina's home page is too messy. It still works. This problem won't happen.
This can only be viewed in ff.
Http: // 124.42.34.97/Noname2.html


4. The animation is usually set timeout/setInterval. When multiple concurrency occurs, it is usually clear. The question is, if you clear the timestamp but the called function is cleared, I think it will be clear (I never thought about this problem ).

5. The difference between the weird mode and the traditional mode is that the xhtml mode is used at ordinary times. I really don't know this.
In Weird mode, ie width = width + padding + margin, and xhtml mode = width
I will know this. I will never start from here. Thank you for learning.

6.html element semantics. This is not very easy to understand. In fact, it has never been seen at all.

7. Regular Expressions. I asked (? = )(? :)
I have been using (? =) Never used (? :)
Now you know
"AB". match (/(? = B)/) print
"AB". match (/(? : B)/) print AB
Haha
It is also used to solve the performance problem of writing regular expressions.
To tell the truth, I did not really think about it first. I used to think about writing it out and adding concise content, but I didn't think about performance.

8. floating. Generally, I add a <div style = clear: both> </div> to remove the floating, but this adds more Divs, how can I do this without adding extra div? Do I directly write clear: left/right in the next div?
My answer
<! Doctype html public "-// W3C // dtd html 4.0 Transitional // EN"> <HTML> <HEAD> <TITLE> New Document </TITLE> <meta name = "Generator "CONTENT =" EditPlus "> <meta name =" Author "CONTENT =" "> <meta name =" Keywords "CONTENT =" "> <meta name =" Description "CONTENT = ""> <style> div {border: 1px solid # c0c0c0; width: 200px; height: 200px; margin: 0 5px 0 0 ;} </style> </HEAD> <BODY> 12 3 4 </BODY> </HTML>
[Ctrl + A select all Note: If you need to introduce external Js, You need to refresh it to execute]
9. Are there any other elements in addition to the elements that keep the tbody in the table?
My answer is thead, tfoot, tbody

The most disappointing thing is the failure to see the shadow (only three sides can see it), but there are also a lot of GAINS. I know many of my own shortcomings, and the gains are greater than the loss.

Related Article

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.