Netease front end face questions summarize, you've seen a few?

Draw the focus       
 was fortunate enough to receive an interview NetEase, do not hesitate to interview the interview - three, because've never been there Xibeiwang Zhongguancun area, the meal went early, there should be imagined bustling place, to found in construction, many still under construction, see the next Baidu and Sohu Netease, they are long buildings or tall buildings, both full of big business into a visual perception to under no net = = Netease building, in which also nothing to do, to stay outside to look at the front end of things ready, when the time 2:40 at the front desk said, Netease a younger sister took me to go up -

Come to the question - written test

I thought the only interview and found that my sister is not with me to the interview, took me to the room, leaving the two topics to me, say half an hour, the defenseless, then come to the question it ~
Netease front end face questions summarize, you've seen a few?
1.alert (1 && 2), alert (1 || 0)
specifically I do not remember anyway, these two, I think the test is a purely operational and or operations, later found too naive
alert (1 && 2) the result is 2
as long as the "&&" front false, regardless of the "&&" later is true or false, the result will be returned "&&" preceding value;
long "&&" front is true, regardless of the "&&" later is true or false, the results are will return "&&" following values;
Alert (|| 0. 1) is the result of
long "||" front is false, regardless of the "||" followed true or false, the return value back "||"
long " || "earlier is true, regardless of" || "behind is true or false, all return" in front of value ||. "

Mouseover the difference 2.mouseenter and
this looked at before, it is probably the answer came out, but it might not detailed enough
regardless of the mouse pointer through the selected element or its child elements, will trigger mouseover event. Correspondence mouseout
Only when the selected element, mouseenter event will trigger the mouse pointer through. Correspondence mouseleave

3. Use regular expression matching string, begin with a letter followed by a number, string or underscores, a length of 9-20
to see this problem I was collapsed, because much of the regular school, but also a little write down almost just forget some
var re = new RegExp ( "^ [a-zA-Z] [a-zA-Z0-9 _] {9,20} $");

Prototyping methods 4.js string interception on both sides of the blank trim
// my stupid method was wrong also want some, come back for a moment to realize, this idea is
String.prototype.trim = function () {
 var arr this.split = ( "");   
 the while (. 1) {   
  IF (ARR [0] == "") {    
       arr.shift ();              
   Continue;     
    }       
 BREAK;    
  } 
  the while (. 1) {   
    IF (ARR [arr.length -1] == "") {  
         arr.pop ();             
    the Continue;      
   }       
   BREAK;      
  }   
 return arr.join ( ""); 
 } // later, the interviewer told me that word will be solved, but I have forgotten regular , usually not how to use 
 String.prototype.trim = function () { 
   return this.replace (/ (^ S ) | (S $) / G, '');   
 };

The three questions are output determination classic problem
 //5.1
var. 4 = A
function B ()
    A =. 3;    
  the console.log (A);   
  function A () {}; 
 } B ();  
// clear output is 3, because it modifies a global variable, the function a () {} are used to interfere with, although the function declaration will increase, it was a given overwritten, it is my understanding
//5.2 
// can not remember the specific like the following
 var = baz. 3; 
 var = {the bazz    
  baz: 2,   
  getbaz: function () {  
        return this.baz        
  } 
 }  
 the console.log (bazz.getbaz ())  
 var G = bazz.getbaz;  
 Console .log (G ());  
  // 2 is first output, a second output is 3, this problem is investigated this point, when the object itself as a function of this property called pointing object, as an ordinary function call to the global time on the  
 //5.3var ARR = [1,2,3,4,5];  
 for (var I = 0; I <arr.length; I ++) 
 {     
  ARR [I] = function () {  
 Alert (I)  
 }  
 }  
 ARR [. 3] (); 
 // Typical closures ah, without looking at, certainly pop 5 ah

6. position to write different values and differences
suddenly think there inherit, then forgotten again later interview when I asked about the
absolute: generate an absolutely positioned element, positioned relative to the first parent element other than static positioning . Position of the element by "left", "top", "right" and "bottom" predetermined attribute. (Non-spacing)
relative: generating a relative positioning element for positioning relative to its normal position. Therefore, "left: 20" adds 20 pixels to the element's LEFT position. (Placeholder)
static: the default value. No positioning element occurs in the normal flow (ignoring top, bottom, left, right or z-index statement) inherit: predetermined position property should inherit from the parent element.
fixed: generating element absolute positioning, relative to the browser window positioning. Position of the element by "left", "top", "right" and "bottom" predetermined attribute.

7. Write a div + css layout, the picture on the left to the right of the text, wrap text around the picture, outside of the container fixed width, the text is not fixed (which is described later in accordance with the interviewer, the questions only pen drawing I do not impress)
the Road I did not answer questions well, I do not know the beginning of the text that is to say with adaptive interviewer p wrapping text label, I was nervous under the mistaken label p inline, and then I corrected, then add left floating, then no, I told the interviewer that I used to have a direct img it float: left, add text without the p tag like to try then I came back only to find = = p added directly on the label it ah = =, omg my mistake! ! !

8. about your understanding of reflow and repaint of
this really is not yet in contact with, the first one I guess is re-layout, the second is to redraw'd ever seen, thought document.write (), not this again later asked me to look up to check
repaint is redrawn, reflow is reflux. repaint redraw mainly performed for one DOM element, reflow is refluxed for rearranging the entire page
severity:
under the premise of performance priority, performance overhead is greater than reflow repaint.

Reflect:
the repaint is a DOM element is redrawn; reflow is to rearrange the entire page, the page is rendered all DOM elements.

How to trigger:
style changes caused repaint and reflow. It does not involve any change in the layout problem DOM element is repaint, such as changes in color elements / text-align / text-decoration etc. property. In addition to modifying the DOM element style mentioned above substantially reflow. Relates to any modification of the elements, for example, length, width, line height, borders, and other style of the display.

Common triggers scene:
Trigger repaint:

color changes, such as color = # ddd

text-align modifications, such as text-align = center

a: hover also cause redraw

: Hover cause color change does not lead to style page reflux.

Trigger reflow:

width / height / border / margin / padding modifications, such as width = 778px;

Animation,: hover elements such as pseudo-class performance caused by changes, display = none other causes such as DOM elements appendChild page reflux operation;

font type style modification;

background changes, the attention might literally thought it was redrawn, but the browser does reflux, and is optimized for browser manufacturers to modify part of the background of the trigger only repaint, of course, do not consider IE;

scroll the page, this is inevitable;

resize page, the desktop version of the zoom, the size of the mobile terminal browser, then, have not played can drag the program, multi-window operating system resize the program window size.

Read the properties of the elements (can not understand this, but the technology is up to people to say, it would take it as it Theorem): read certain properties of the elements (offsetLeft, offsetTop, offsetHeight, offsetWidth, scrollTop / Left / Width / Height, clientTop / Left / Width / Height, getComputedStyle (), currentStyle (in IE));

How to avoid:
possible to modify the style attributes of the element by changing the class in DOM tip: Reduce the affected DOM element as much as possible.

Avoid setting multiple inline style: using your favorite class way to style, to avoid access to the DOM when you set the style inefficiency.

Animate elements position property to fixed or absolute: As the current DOM element separate from the stream, and therefore affected only the current element, the element repaint.

Sacrificing smoothness meet performance: Animation precision is too strong, will cause more times repaint / reflow, sacrificing accuracy, to meet the performance loss, get balance of performance and smoothness.

Avoid using table layout: change the size and contents of each element of the table, will cause the entire table is recalculated, resulting in substantial repaint or reflow. Div switch can be targeted to avoid unnecessary repaint and reflow.

Avoid using expressions in CSS: CSS is time to learn to know, this should be avoided, should not go to this level to deepen understanding, because the consequences are very serious indeed, once the animation of repaint / reflow present, then each animation frames are calculated consumption performance can not be underestimated.

Interview part

After half an hour to finish the written test, waiting for the interview, hh met halfway BUPT brothers talked some nodejs things
come to the interview questions
When did you start to learn the tip
how to learn the front
read the blog who
began to look at my resume and asked, and asked the project asked webpack / gulp difference, ask how the project achieved what, ask the pen questions (above talked about)
and so on and so asked the project

These basic will, interviewers were quite good, feeling no pressure ~ finally let me through it, I have to say much to see really basic things - foundation is not yet solid Kazakhstan, but in general, this life first interview quite smoothly, he said that luck is okay ~ hope to go on the road to steady it ~

Guess you like

Origin blog.51cto.com/14337100/2402835