My friend recommended me to go to ping An subsidiary company for an interview. Without the first interview, I directly entered the second and third interviews. It was quite simple. Let’s talk about the interview questions.

On a technical topic

1. What is the difference between document.ready and onload?

When a page is loaded, there are two types of events: ready, indicating that the document structure has been loaded (excluding non-text media files such as images), and onload, indicating that all elements of the page, including images, have been loaded. (You can say: ready before onload!!)

General style controls, such as image size controls are loaded in onload;

Methods triggered by jS events can be loaded in ready;

2. A topic about variable promotion

function a(){}
var a
console.log(typeof a) //functionCopy the code

And talk about the project experience. Blah, blah, blah… When he asked me, I thought it was a pressure test. I said that if 996 was normal, it would not be accepted. If the project was urgent, I would have to work overtime and rush the project on Saturday… About ping an salary system, the year-end bonus is 4.8 months salary, how many percent can get it, most people can get it, the above is the second interview, the third interview is the project manager, also asked some projects, according to their own said to ask some questions… Very easy to deal with, my experience is that as long as you feel that the project manager is not engaged in the front end, the interview position is completely controlled by yourself… And then it’s over, hahaha… Next is the personnel call, prepare a lot of things, salary proof, resume to input peace resume library center, and IQ, EQ what test, to this step I did not go to do, good trouble, did not tell me how much salary to me, personnel said after the above steps to set salary, then give up decisively… Unexpectedly, my company gave me a raise…

The following is an interview of Ping An Bank, written by a friend (direct stickers, hahaha)





The answer

Jion (‘,’) becomes array, then split(‘,’)

But it requires recursion, and recursion is also simple, mainly to see if it’s an array, and then the end of the recursion condition



Lite version

const deepFlatten = arr => [].concat(... arr.map(v => (Array.isArray(v) ? deepFlatten(v) : v)));Copy the code

2.

A more streamlined implementation

const groupBy = (arr, fn) =>
  arr.map(typeof fn === 'function' ? fn : val => val[fn]).reduce((acc, val, i) => {
    acc[val] = (acc[val] || []).concat(arr[i]);
    return acc;
  }, {});Copy the code

Plus: Algorithm lite recommended to see github.com/Chalarangel… Is a good thing

3.4. Figure your own, hahaha

Here is the wheel interconnect pen test (or my friend’s face)



1. The physical resolution is supported by the hardware, the logical resolution is achievable by the software, multiplied by the pixel multiplier

In detail:


On the iphone3gs, the logical resolution is 320 x 480, and the physical resolution is 320 x 480

After the iphone4 came out, the logical resolution was 320*480, the same as the 3gs, and the content displayed was the same, but the physical resolution became 640*960. The original content in the 3gs was one pixel, but the iphone4 was filled with 4 pixels, so the content displayed was the same. But the iphone4s’s screen is twice as fine as the 3gs’s, with a pixel ratio of 2.

Iphone5/5s /SE logical resolution is 320*568, compared with iphone4, the logical resolution width is unchanged, the height has increased, so compared to iphone4, the width content is displayed as much, but the height content has increased. The physical resolution is 640 x 1136, and the pixel ratio is the same as iPhone 4/4S, which is twice

The iphone6 has a logical resolution of 375*667, which is larger than the iPhone 4/4s/5/5s/SE, so it displays more content. The physical resolution is 750*1334, so it’s still 2x pixel magnification, just like the models mentioned above

The iphone6plus has a logical resolution of 414 x 736 and a physical resolution of 1080 x 1920, with a pixel multiplier of about 2.6. Render at 1242*2208 pixels. The system will compress the image down to 1080*1920, assuming a physical resolution of 1242*2208 (a multiplier of 3). Therefore, the size 1242*2208 of the design drawing made by 6Plus is based on the assumption that the actual physical resolution is 1080*1920. It is said that due to the consideration of production capacity and power consumption, 1242*2208 May be directly used for performance improvement in the future

Block formatting context (BFC). It is a separate rendering area, with only block-level box participation, which dictates how the internal block-level box is laid out and has nothing to do with the outside of the area.

BFC layout rules:

  1. The internal boxes will be placed vertically, one on top of the other.
  2. The vertical distance of the Box is determined by margin. Margins of two adjacent boxes belonging to the same BFC will overlap
  3. The left side of the margin box of each element touches the left side of the border box containing the block (for left-to-right formatting, otherwise the opposite). This is true even if there is a float.
  4. The region of the BFC does not overlap with the float box.
  5. A BFC is a separate container on a page, and the child elements inside the container do not affect the outside elements. And vice versa.
  6. When calculating the height of the BFC, floating elements are also involved

Which elements generate the BFC:

  1. The root element
  2. The float property is not None
  3. Position is absolute or fixed
  4. Display inline-block, table-cell, table-caption, flex, inline-flex
  5. The overflow is not visible

3. Same-origin indicates that the domain name, protocol, and port are the same. If the domain name, protocol, and port are different, the domain name is cross-domain

Solution:

Node proxy, specifically their own node service, forward in node from the browser request, node service and browser request to the same origin, and then forward carrying specific parameters, cookie… , forward to the backend cross-domain interface, forward library can use Axios, support is available on Node, and browsers (see Github for implementation).

Nginx configuration proxy (basic configuration, refer to my previous article)

In React, the agent can be configured with webpack-dev-server in Vue

Access-control-allow-origin: * on the backend

jsonp

. Other senses are not very practical in real life development

4.var reg = /^[\u4e00-\u9fa5]{1}[A-Z]{1}[A-Z_0-9]{5}$/

5.

Three steps

1. Find the benchmark (generally based on the middle term)

2. Traverse the number group, those less than the baseline are placed on the left, and those greater than the baseline are placed on the right

3, the recursion

        functionQuickSort (arr){// If the array <=1, it returns directlyif(arr.length<=1){returnarr; } var pivotIndex=Math.floor(arr.length/2); Var pivot= pivot. Splice (pivotIndex,1)[0]; Var left=[]; var right=[]; // Smaller than the baseline is placed left, larger than the baseline is placed rightfor(var i=0; i<arr.length; i++){if(arr[i]<=pivot){
                    left.push(arr[i]);
                }
                else{ right.push(arr[i]); }} // Recursivereturn quickSort(left).concat([pivot],quickSort(right));
        }
Copy the code

<div style=”color:Red;” ></div>

2. The secondary priority is (ID selector, assuming level 100)#myDiv{color:Red; }DivClass {color:Red; divClass{color:Red; } 4. The last priority is (tag selector, assuming level 1) div{color:Red; } divClass span {color:Red; } Priority level: 10+1=11Copy the code

7….

Next update…

conclusion

Now interview, small company asks frame commonly and see your individual learning ability, for instance my company, I see his study and research ability commonly, big company sees basic ability commonly, I did not have how face, nevertheless a lot of on the net have article reference. If you want to succeed in the interview, you must have a solid foundation, business ability, of course, expression is also very important, personal research like coding, some companies are also very important.

juejin.cn/post/1