Web front-end development interview abused article (i)

Source: Internet
Author: User

Location: Beijing

Position: Front-end Development engineer

Requirements: To achieve intermediate development, JS Foundation is solid enough, CSS Foundation is solid, requires pure handwritten code

Interview Process:

The door of an aging uncle handed me a question, said that the other is not good to make the first look at the level, the tone of speech is very mild obviously is too many people to take the question straight to the conference room to begin the written test answer is part of the written question:

 varA=function(name) {if(name) This. name=name;} varb=function(name) { This. name=name;} varC=function(name) { This. name=name| | " Jon}; A.prototype.name= "Tom"; B.prototype.name= "Tom"; C.prototype.name= "Tom"; //find the following three output valuesAlertNewA (). name); Alert (NewB (). name); Alert (NewC (). name);

Problem-solving ideas. This is the test of the prototype chain Mastery, first a function inside to determine if name has value, This.name=name of course name has value!! It's undefined! Re-assignment name this only current scope query current prototype chain Name property Tom so the first item is Tom.

The second is not difficult to understand is undefined, the third is just an operator problem is not difficult name is undefined definitely choose behind Jon. So the answer is Tom Undefind Jon.

var test= (function(i) {  returnfunction() {      alert (i* 5);}  ) (5); Test (2); // What is the value?

Do not be confused by this problem, the test center self-executing function, the form of participation in the argument, the default parameter is 5, so the tests value 2 is not received at all, so the answer is 25

var a= "xx";(function() {    alert (a); // What is    the output of a? var a= "n";}) ();

Thinking: self-executing function, global variable A, local variable a will traverse the context when it is loaded from the execution function. This is called the execution context, refer to the Uncle this blog post: http://www.cnblogs.com/TomXu/archive/2012/01/13/2308101.html

The execution context contains a variable but no loader starts to execute alert so current a=undefined, if the context result is executed after the local variable A is deleted and no variable-declarator index to global variable A is output "00", which is equivalent to a normal load of the program, but not ( Personal understanding if there is a mistake please point out)

Summarize stacks and queues and implement simple stacks or queues.

This problem is relatively simple, the test theory to grasp the data structure. 1. Difference, stack, advanced out, queue, FIFO 2. Limit 3 for INSERT and delete operations. Data read speed is different

Stack is a linear table that restricts insertions and deletions to only one end of a table.
A queue is a linear table that qualifies only one end of a table to be inserted and deleted at the other.

Brief introduction to CSS hack understanding.

CSS hack is by adding some special symbols in the CSS style, so that different browsers recognize different symbols (what kind of browser recognizes what symbols are standard, CSS hack lets you remember this standard) to achieve the purpose of applying different CSS styles, such as. kwstu{ width:300px;_width:200px;}, the General browser will first give the element to use width:300px, the style, followed by a _width:200px, because the underscore _width only IE6 can be recognized, So this style in IE6 actually set the width of the object is 200px, the back of the previous to the cover, and other browsers do not recognize _width does not perform _width:200px, this sentence style, so in other browsers set the width of the object is 300px;

The bubble sort and quick sort are briefly described and implemented simply:

Principle:

1. Bubble sort: Double loop nesting, before and after the data is relatively small put in front, big put in the back.

2. Fast sorting, need intermediate container bar The array is divided into two groups, which are larger than the large arrays, and then merge two arrays in the decimal group.

Bubble Sort:

Arbitrarily from the array to take a number and the next comparison, if you want to order from small to large, then put the little one in front, Big put in the back, simply to exchange their position, so the exchange of the position can be ordered to get the effect.

vararr = [3,1,4,2,5,21,6,15,63];functionSorta (arr) { for(vari=0;i<arr.length-1;i++){         for(varj=i+1;j<arr.length;j++){                      //gets the first value and the last value comparison            varCur =Arr[i]; if(cur>Arr[j]) {                      //because we need to exchange values, we will replace the latter value, we need to save it first.                varindex =Arr[j]; //Exchange ValueARR[J] =cur; Arr[i]=index; }        }    }    returnarr;}//because a loop can only exchange one maximum value, a second layer of for loop is required. 

Quick sort:

Take a value from the middle of the array and compare it to the values in each and every number of arrays, if it is greater than the one side, less than the side, and then merge, then compare, and so on again.

vararr = [3,1,4,2,5,21,6,15,63];functionSorta (arr) {//if only one person, there is no need to compare    if(arr.length<=1){        returnarr; }    //gets the index of the middle value    varLen = Math.floor (ARR.LENGTH/2);//Intercept Intermediate Values    varcur = arr.splice (len,1); //less than the median value, put this inside .    varleft = []; //It 's bigger than the inside.    varright = [];  for(vari=0;i<arr.length;i++){        //Judging if it is greater than        if(cur>Arr[i])        {Left.push (arr[i]); }Else{Right.push (arr[i]); }    }    //by recursion, the previous round of better arrays is merged and compared again.     returnsorta (left). Concat (Cur,sorta);}

Temporarily only remember these topics, in short, when the comparison of interview answer plugin did not enter the two side, continue to ~

Experience: The foundation is particularly important, after answering these questions feel a lot of questions in the JavaScript Advanced programming This book has the answer, the interviewer evaluation base is not solid enough to understand the answer is not enough capacity is not firm, the work is too introductory (personal recharge system including the cashier, etc.), Note that this is a primer. Rather than beginner, a painful interview goes home and eats books and continues to refuel.

Web front-end development interview abused article (i)

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.