On the one hand, most of the questions are not of high quality. On the other hand, there are few answers. Even if you get the interview questions, it will not help you much.

Recently, I spent some time for you to sort out the 2020 first – and second-tier Internet companies, including JavaScript, algorithm, network & security, Vue, React and a large number of front-end knowledge points and related interview questions. The answer and analysis are also sorted in the article, sorting is not easy, please pass by the strong man to star, if you can star fork watch three even better, thank you 😄 🙏

Because of the length, this article includes the first 50, the last 50 will be updated in the next article, welcome to follow.

1. Write mySetInterVal(fn, a, b) for each interval a,a+b,a+2b, and then write myClear to stop mySetInterVal above

Company: Headline

Classification: JavaScript

Answer:


2. Merge two dimensional ordered numbers to form one dimensional ordered array, merge sort idea

Company: Headline

Classification: Algorithms

Answer:


3. Fibonacci series

Companies: Tencent, CVTE, Microsoft

Classification: Algorithms

Answer:


4. The maximum length of the string that is not repeated

Company: Tencent

Classification: Algorithms

Answer:


5. This section describes the versions of Chrome

Company: Didi

Category: Network & Security

Answer:


6. What details can be optimized in React project? What performance optimizations have been made in actual development

Companies: Didi, One to one, netease, Youzan, Hujiang, Ximalaya, Kujiale, Kuaishou

Classification: the React

Answer:


7. What did the latest version of React fix and add

Company: Didi

Classification: the React

Answer:


8. Describe Http caching policies. What are the differences and what problems do they solve

Company: Didi, tiaotiao, netease, Easy car, Pulse, one on one, hupu, dig money, love fan son

Category: Network & Security

Answer:


9. Introduce the principle, difference and application of anti-shake throttling, and implement it with JavaScript

Companies: Didi, Hupu, Wacai, 58, Toutiao

Category: JavaScript, programming questions

Answer:


10. Front-end security, man-in-the-middle attack

Company: Didi

Category: Network & Security

Answer:


11. On closures, why use closures? Explain how closures work and how they can be used

Companies: Didi, Ctrip, Ximalaya, Weici, Mogujie, Kujialuo, Tencent Appao, Anjuke

Classification: JavaScript

Answer:


12. CSS pseudo-classes and pseudo-elements

Company: Didi

Classification: Css

Answer:


13. Have a bunch of round numbers, divide them into three parts and make sure each part is as equal as possible (11, 42, 23, 4, 5, 6, 4, 5, 6, 4, 5, 6, 11, 23, 42, 56, 78, 90)

Company: Didi

Classification: Algorithms

Answer:


14. Implement _. Get for lodash

Company: Didi

Classification: JavaScript

Answer:


15. Realize the add (1) (2) (3)

Company: Didi

Classification: JavaScript

Answer:


16. Implement chained calls

Company: Didi

Classification: JavaScript

Answer:


React event binding principle

Companies: Didi, Hujiang

Classification: the React

Answer:


18. What is the difference between array-like and array-like

Company: Hikvision

Classification: JavaScript

Answer:


19. What optimizations webPack has made, in terms of development efficiency, packaging strategy, etc

Company: Didi, Kuaishou, one to one, high thought education

Classification: engineering

Answer:


20. Event loops (Node, browser)

Companies: Didi, Companion Fish, Autonavi, Freely, Hupu, 58

Category: Node, JavaScript

Answer:


21. How to encapsulate Node middleware

Companies: Didi, Kugou

Classification: the Node

Answer:


22. How does the node middle tier do the request merge and forward

Company: easy car

Classification: the Node

Answer:


23. Introduce the features, advantages and disadvantages of promise, and how to implement the promise internally

Companies: Didi, Tiaotiao, Himalaya, Taeba, Secu, Percentile, 58, Anjuke

Category: JavaScript, programming questions

Answer:


24. Realize the Promise. All

Promise.all = function (arr) {
  // Implementation code
};
Copy the code

Companies: Didi, Tiaotiao, Youzhan, Weidoctor

Category: JavaScript, programming questions

Answer:


25.React component communication mode

Companies: Didi, One to one, Himalaya, Mogujie

Classification: the React

Answer:


26. Comparison of Redux-Saga and Mobx

Company: one on one

Classification: the React

Answer:


27. Tell me about react-fiber

Company: headline, drip, cainiao network, dig money, Himalaya

Classification: the React

Answer:


28. Publish and subscribe by hand

Companies: Didi, Toutiao

Classification: JavaScript

Answer:


29. Write array to tree

Company: Didi

Classification: JavaScript

Answer:


30. How to access arR [-1] using ES6proxy

Company: Didi

Classification: JavaScript

Answer:


31. Write the result of the following code execution

console.log(1);
setTimeout((a)= > {
  console.log(2);
  process.nextTick((a)= > {
    console.log(3);
  });
  new Promise((resolve) = > {
    console.log(4);
    resolve();
  }).then((a)= > {
    console.log(5);
  });
});
new Promise((resolve) = > {
  console.log(7);
  resolve();
}).then((a)= > {
  console.log(8);
});
process.nextTick((a)= > {
  console.log(6);
});
setTimeout((a)= > {
  console.log(9);
  process.nextTick((a)= > {
    console.log(10);
  });
  new Promise((resolve) = > {
    console.log(11);
    resolve();
  }).then((a)= > {
    console.log(12);
  });
});
Copy the code

Classification: JavaScript

Answer:


32. Write the execution result

function side(arr) {
  arr[0] = arr[2];
}
function a(a, b, c = 3) {
  c = 10;
  side(arguments);
  return a + b + c;
}
a(1.1.1);
Copy the code

Classification: JavaScript

Answer:


33. Write the results of the execution

var min = Math.min();
max = Math.max();
console.log(min < max);
Copy the code

Classification: JavaScript

Answer:


34. Write the results and explain why

var a = 1;
(function a () {
    a = 2;
    console.log(a); }) ();Copy the code

Classification: JavaScript

Answer:


35. Write the result and explain why

var a = [0];
if (a) {
  console.log(a == true);
} else {
  console.log(a);
}
Copy the code

Classification: JavaScript

Answer:


36. Write the results and explain why

(function () {
  var a = (b = 5); }) ();console.log(b);
console.log(a);
Copy the code

Classification: JavaScript

Answer:


37. Write the results and explain why

var fullname = 'a';
var obj = {
   fullname: 'b'.prop: {
      fullname: 'c'.getFullname: function() {
         return this.fullname; }}};console.log(obj.prop.getFullname()); // c
var test = obj.prop.getFullname;
console.log(test());  // a
Copy the code

Classification: JavaScript

Answer:


38. Write the result and explain why

var company = {
    address: 'beijing'
}
var yideng = Object.create(company);
delete yideng.address
console.log(yideng.address);
Copy the code

Classification: JavaScript

Answer:


39. Write the results and explain why

var foo = function bar(){ return 12; };
console.log(typeof bar());  
Copy the code

Classification: JavaScript

Answer:


40. Write the result and explain why

var x=1;
if(function f(){}){
    x += typeof f;
}
console.log(x)
Copy the code

Classification: JavaScript

Answer:


41. Write the result and explain why

function f(){
      return f;
 }
console.log(new f() instanceof f);
Copy the code

Classification: JavaScript

Answer:


42. Write the result and explain why

var foo = {
        bar: function(){
            return this.baz;
        },
         baz:1
    }
console.log(typeof (f=foo.bar)());
Copy the code

Classification: JavaScript

Answer:


43. Describe the problems and reasons that should be paid attention to during the development of React Hooks.

Answer:


44. Does the name option in the Vue component serve any other purpose than keep-alive? Can you tell me what you know about keep-alive? (usually used and source code implementation)

Classification: Vue

Answer:

45. Why does Vue use vm.$set() to solve the problem of the object not responding to new attributes? Can you explain how the following code works?

Vue.set (object, propertyName, value) 
vm.$set (object, propertyName, value)
Copy the code

Classification: Vue

Answer:


46. Since Vue can accurately detect changes in the specific DOM through data hijacking, why do you need virtual DOM diff?

Classification: Vue

Answer:


47. What is true about the advantages and disadvantages of vue.js virtual DOM? (pops)

A. A performance lower limit is guaranteed, which is much better than rough DOM manipulation, so the framework’s virtual DOM at least ensures that you can still provide decent performance without having to manually optimize. B. There is no need to manually operate the DOM, only need to write the code logic of view-Model, the framework will help us to update the View in a predictable way according to the virtual DOM and data two-way binding, greatly improving our development efficiency; C. Extreme optimization: Virtual DOM + reasonable optimization can achieve extreme performance D. It can be cross-platform. Virtual DOM is essentially a JavaScript object, while DOM is strongly related to the platform. In contrast, virtual DOM can be more easily operated across platforms, such as server rendering, WEEX development, and so on.

Classification: Vue

Answer:


48. What does the following code output?

for (let i = 0; i < 3; i++) {
  setTimeout((a)= > console.log(i), 1);
}
Copy the code

Classification: JavaScript

Answer:


49. Write the result and explain why

const num = {
  a: 10,
  add() {
    return this.a + 2;
  },
  reduce: (a)= > this.a 2 -;
};
console.log(num.add());
console.log(num.reduce());
Copy the code

Classification: JavaScript

Answer:


50. Write the result and explain why

const person = { name: "yideng" };

function sayHi(age) {
  return `The ${this.name} is ${age}`;
}
console.log(sayHi.call(person, 5));
console.log(sayHi.bind(person, 5));
Copy the code

Classification: JavaScript

Answer:

Front brush problem artifact

Not enough for these problems? Scan the code to enter the front interview planet 🌍, unlock the brush question artifact, but also can obtain 800+ front end test questions and a line of common interview high-frequency test points.