Essential Interview Questions
Js based
1. Print a multiplication table with JS
The interviewer will examine your familiarity with the basic API of JS printing, as well as basic mathematical knowledge
console.log(` 1 * 1 = 1 2 * 2 * 2 = 1 = 2 3 4 * 1 = 3 3 * 2 = 6 3 * 3 = 9 4 * 1 = 4 4 * 2 = 8 4 * 4 * 4 = 3 = 12 16 5 * 1 = 5 5 * 2 = 10 5 * 3 = 15 5 * 4 = 5 * 5 = 20 6 * 1 = 6 * 2 = 12 * 3 = 18 6*4=24 6*5=30 6*6=36 7*1=7 7*2=14 7*3=21 7*4=28 7*5=35 7*6=42 7*7=49 8*1=8 8*2=16 8*3=24 8*4=32 8*5=40 8*6=48 8*7=56 8 * 8 = 64 9 * 1 = 9 9 * 2 = 18 9 * 3 = 27 9 * 4 = 36 9 * 5 = 45 54 9 * 9 * 6 = 7 = 63 * 8 = 72 9 * 9 ` = 81)
Copy the code
Fibonacci sequence function (up to 30)
The Fibonacci sequence is the sum of the first two numbers in the sequence
Fibonacci sequence is a difficult or simple topic, from violent recursion, to dynamic programming, as well as mathematical formulas and matrix optimization several levels, here requires less than 30, indicating that the performance requirements are not high, belongs to the entry to send points level
const arr = [0.1.1.2.3.5.8.13.21.34.55.89.144.233.377.610.987.1597.2584.4181.6765.10946.17711.28657.46368.75025.121393.196418.317811.514229.832040.1346269]
var fib = function(N) {
return arr[N]
}
Copy the code
Write a Promise
Although programmer has been using the keyboard, but the word itself is a facade, the whole is relatively simple, write well is extra points, write bad also won’t hang you
Handwriting anti – shake throttling
Similar to the last question, often meet the test questions other handwriting VUE response, handwriting algorithms are similar
Sort without sort, such as [3,2,6,9,1,4,8] returns the sorted array
The test points are common kinds of sorting algorithms, such as bubbling, quick sorting, etc., may also examine the space and time complexity and other issues, is one of the important reasons many front-end want to learn algorithms: interview to use
function mySort(arr){
return [1.2.3.6.8.9]}Copy the code
Please implement a permute function, enter the number 123, and print out the full array of the three numbers
The whole arrangement seems simple, but it is actually quite difficult, requiring the interviewer to understand recursion and backtracking
function permute(){
return[[1.2.3],
[1.3.2],
[2.1.3],
[2.3.1],
[3.1.2],
[3.2.1]]}Copy the code
Code pen test
According to the characteristics of the input, judge the output, mainly is how to efficiently filter the filter conditions
function findFirstAbsentPositiveNumber(arr) {
if (arr[0= = =0) {
if (arr[1= = =1) {
if (arr[2= = =2) {
return 5
}
return 2
}
return 1
}
return 1
}
Copy the code
Frameworks and best practices
What’s the difference between v-show and V-if
This topic focuses on the application of vuejS
Both functions are similar in that they control the display and hiding of elements, but the V-show code is a little more showy
Special instructions
This is an entertainment post, I did not expect that there will be serious students correct mistakes, your serious let me feel sorry, in case really misled the novice is guilty, here to explain, the above answer unified instead
The main difference between “v-show” and “v-if” is that one is “show” and the other is “if”, but according to the pronunciation, “V-show” is more showy
Thank you for your serious, but your answer, I will also reply, since you are serious to be read, write well, do not write such a random answer for granted, some beginners, may see you write this serious difference, believe it true, you are not irresponsible, I think you just read on some blog that v-show is the difference between display Block and None and took it for granted. You never read the vue source code
There are two mistakes
- V-show is not a blind cut of block and None
- Instead of generating this node on the DOM, v-if is a ternary expression that controls generating the VDOM instead of the DOM
If you want to be responsible, I think this is a good answer, and it will be the only honest answer in this article
Vue2 era
Vue’s template-Explorer will parse v-show and v-if into render functions with different processing logic, v-if into teraries and v-show into directives
V-if is easy to understand, ternary expression, control vDOM, v-show generated directive code can be seen here parsing logicV – show the source codeIf you were that serious, you’d have seen this code, but you thought you were
If not node, set originDisplay to the previous el.style.display, which could be flex, inline, inline-block, etc
Vue3 era
The first step is to look at template parsingIf you’re really serious about what _withDirective and openBlock 512 mean, I’ll keep you in the loop and read the code for yourself
Here thank you for your serious, and make fun of your not serious
Error handling in projects
source
Not all bugs are predictable. It’s important to have a clear mind, which is important for programmers
Have you designed components before
Vue and React are the most popular frameworks for componentization. If we can separate the framework and show the idea of componentization, it will be a perfect answer. Let’s use the common rate component as an example
Painted "u u u u being fostered fostered fostered fostered".slice(5 - rate, 10 - rate);
Copy the code
Talk about your understanding of SPA
The word SPA comes from the Latin “Solus Par Agula” (SPA refers to the use of water resources combined with bath, massage, apply maintenance products and incense to promote metabolism, to meet the human vision, taste, touch, smell and thinking to achieve a relaxed enjoyment of body and mind. Schedule programmers work hard, especially shoulder neck and wrist stiffness, frequent SPA can alleviate these symptoms, front-end engineers must, need to often go to SPA
Do you have the habit of reading source code?
Measure your job saturation
Answer: no, usually mainly with the project
Soft skills
How to communicate with product meeting when the requirements are too complicated
In fact, this question is about soft skills, which is also the necessary skills for programmers to advance and managers. How to communicate horizontally, coordinate requirements and lead the team to align together, and let the product understand the difficulty of realizing your requirements
Cut demand
The department has too many demands, how to coordinate overtime and family
This is also part of the soft skill set. To see if you fit in with the culture of the team, such as overtime, or WLB, the ideal answer is not to be too humble about mindless overtime, nor to just not do it
An ornament shows an attitude of moderation, work life balance
What are your strengths and weaknesses
My advantage is that I have a solid foundation and rich practical experience. One person can do the work of three, but only for the salary of two
Weakness is like bragging, like number one
Can you work overtime? Like 996
Programmers who abide by laws and regulations are good employees
Chapter 4 Article 36
The State adopts a working hour system whereby labourers shall work no more than eight hours a day and no more than 44 hours a week on average.
Chapter IV Article 41
The employing unit may extend the working hours due to the needs of production and operation after consultation with the trade union and laborers, but generally the working hours shall not exceed one hour a day. If the extension of working hours is necessary for special reasons, the extension of working hours shall not exceed three hours a day under the condition that the health of laborers is guaranteed, but shall not exceed thirty-six hours a month.
Chapter iv Article 44
Under any of the following circumstances, the employing unit shall pay labourers remuneration higher than that for normal working hours according to the following standards: (2) to pay no less than 200 percent of the normal wages to labourers who are arranged to work on rest days but cannot take supplementary rest; (3) to pay no less than 300 percent of the normal wages to labourers who are arranged to work on statutory holidays.
What you write on your resume can bear hardships in particular, what specific reflect
Can only finish the first 80%, do what what not, can eat the first
conclusion
All of the above answers are bullshit. If you get punched in the interview, run away
These questions won’t get you the offer of 20K, but they’ll probably help you run 20KM