[Web Front-end questions sorting 05] Do some front-end questions to rest

Source: Internet
Author: User

Preface

After learning javascript for two consecutive days, we are all tired. So let's take a set of interview questions today. Let's take a rest and prepare for some interviews next week.

Question Overview




Now that we have all questions, let's take it seriously!

Overflow-x belongs to CSS2 or CSS3

When I hit overflow in vs2010, there was no overflow-x prompt, so I decided that it was a property of CSS3, which was used to control the horizontal scroll bar.

Although it is a property proposed by CSS3, it is basically supported by various browsers, so it can be considered as a standard

List several methods to clear the float (at least two)

As we mentioned earlier, it is not reasonable to clear floating because float: none is used to indicate clear floating, so we can change it to closed floating here.

Float will destroy the inline boxes in the line box and cause the line boxes to collapse in height. Therefore, we need to close the float to solve the collapse.

There are only two methods for closed floating:

① Add a new tag and set clear: both for it

② Set the overflow trigger BFC for the parent element to forcibly enclose the floating Element

What we see on the Internet is the above deformation. We can understand the above, and I would like to mention other.

The most classic one is our clearfix.

 {  :; :; :; :; :; }  { :; }

To put it bluntly, it is also a kind of deformation to add new labels.

Difference between display: none and visibility: hidden

The two guys are very different. They can both be used to hide an element, but the difference is:

The display method will remove elements from the document stream. This method may cause page reflow, which is not good for performance, so avoid it.

The visibility method hides the element, but its space is still there.

CSS

. Box {
Background-position: 10px 20px;
Background-repeat: no-repeat;
Background-attachment: fixed;
Background-color: red;
Background-image: url(box.png );
}

{:}

I am not afraid of this question...

Uppercase of the first letter of all English words in a piece of text

I won't answer this question, but it should be a new feature in CSS3. I finally found the information:

He can do what we want.

What is a closure?

This question is basically mandatory. Since we want to answer it, please answer it!

Closure implementation principle

When a function is called, an execution environment and a scope chain are created, and then the activity object is initialized based on arguments and other named parameters.

After an external function is called, its execution environment and scope chain are destroyed, but its activity objects are stored in the closure, and destroyed only after the closure function is called.

Closure implementation

Define the function in the function, and the internal function references the variable of the external function. Finally, the internal function is returned.

Function of closure

Our function can generate something similar to block-level scope. Internal variables cannot be accessed outside, but we need to provide access interfaces. The implementation of this interface depends on our closures.

Closure Problems

Note the use of the closure, because it will increase the load on the memory and have a slight impact on the performance. In addition, the closure may have some error-prone scenarios.

The above is my understanding of closures (What should I do if I want to install B here ?)

What is the difference between call and apply?

Call and apply are methods of functions. They can change the point of this, and their call methods are different.

The call parameter is passed. The apply parameter and arguments parameter are passed in arrays. We recommend that you use them.

Clone an object in Depth

We did this thing yesterday. Deep cloning uses the recursive idea:

        o = obj.constructor == Array ? [] : {};        ( k                                                 o[k] =  obj[k] === 'objext' ?              a = { a: 'aaa', b: 'bbb', c: { d: 'ddd', e: [1, 2, 4   b =   s = '';
In jQuery, $ ('. class') and $ ('div. class') are more efficient in IE 8.

This involves jquery optimization. We know that the jquery selector is searched from right to left.

The above is to first look for the class label, and then find only the div label in the class label, will find twice, it should be the next high

PS: I understand this question. I will try again later.

HTML5 tags

1. Which of the following is NOT a new HTML5 tag:
A. <article>
B. <section>

D. <time>

Abd: I used it when I wrote my blog. Only c does not. I can't select him.

Layout questions

The knife is crazy, the sword is crazy.

Debugging must be performed on the machine.

Conclusion

Today, we made another question, which is difficult. The last two questions are open questions. I will not answer them here. If you are interested, you can leave a message.

If you have a good question, please stay here.

 

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.