“This is the 20th day of my participation in the First Challenge 2022. For details: First Challenge 2022”
preface
I wish you all a happy year of the Tiger ~!
Now, the real questions and interviews of baidu, Alibaba, Tencent, Bytedance and other big companies can be seen everywhere. There are even a number of educational institutions designed courses specifically for this part, but the experience of small and medium-sized factories is scarce.
But in fact, the needs of small and medium-sized factories are still some, many developers may be due to geography, ability, interest, ambition, short or long term and not into the big factory, even if you can obtain the so-called “question sea” through a variety of online channels. Then frantically brush the interview questions, questions sea tactics, but still feel confused about the interview.
I am because of such and such reason (or power), of course, in the short term has no plan to enter the company, combined with recent ready to jump ship, so personally chose nearly 10 mses in dalian for the interview, takes the form of recording, record the interview questions, this paper also presents the coordinates, the small and medium-sized factory in dalian surface.
In order to avoid unnecessary trouble, the company name is A, B and C.
The purpose of this article is the interview, rather than the integration of interview questions. Some interview questions will be explained in this article, and links to many articles that I think are excellent, as well as some of my experience in the interview and how I answered the question at that time will be provided as an idea, but not a standard answer.
A company
The overall summary
Company A will ask several basic questions, and there is no logic between the questions. Then I will ask questions according to the content of the resume and the answers. My resume is basically about VUE technology stack. Since Company A is promoted internally by A friend, it may be that their company does not use VUE, so they do not care about it, so they did not ask any questions about VUE technology stack, nor did they ask questions about project experience.
Interview Questions
- To talk about
css
The box model - Multiple ways to implement the above
100px
Adaptive layout below display
What are the properties- The difference between block elements and inline elements, inline block elements
js
Prototype and prototype chainPerson.prototype.constructor
What is the- Student: Does the function
__ proto __
attribute - To talk about
js
The data type - How to judge the various ways of data type, what are the differences, applicable scenarios
Promise
How do I make multiple asynchronous requests at oncePromise.all
What is the return mechanism of- What if you want one of the requests to fail and not return a result
webpack
How much packaging optimization knows- Big front end understand
koa
How do I start a servernew koa
What did you dokoa
Principle of onion ring modelkoa
Onion rings andexpress
What is the difference between middleware- Long list optimization, 10,000 data without pagination and lazy loading, how to improve performance
- What happens between the time a data request is initiated and the time the data is received
- Do you understand front-end security
csrf
和xss
What is it, and how can it be avoided- How does the front end encrypt the user’s data
- Based on the
md5
Improved security
To talk aboutcss
The box model
👉👉 CSS box model and margin negative value
Multiple ways to implement the above100px
Adaptive layout below
flex
layoutgird
layoutmargin-top + calc
+ calc
display
What are the properties
value | describe |
---|---|
none | This element will not be displayed. |
block | This element is displayed as a block-level element, preceded by a newline character. |
inline | The default. This element is displayed as an inline element, with no newlines around it. |
inline-block | Inline block elements. |
table | This element is displayed as a block-level table preceded by a newline character. |
inherit | Specifies that the value of the display attribute should be inherited from the parent element. |
flex | Elastic box model. |
grid | Grid layout. |
The difference between block elements and inline elements, inline block elements
Block level elements
(1) What are the common block elements?
Common block elements include < H1 >~
, < P >,
,
, < OL >,
- , etc., among which the
tag is the most typical block element.
-
, < OL >,
- , etc., among which the
tag is the most typical block element.
(2) What are the characteristics of block-level elements?
- Own a line
- Height, width, margins and margins can be controlled.
- The width defaults to the container (parent width)
100%
- Is a container and box that can release internal or block-level elements
(3) Attention:
Only text can form paragraphs, so you can’t put block-level elements inside p tags, especially div tags. The same goes for the h1, H2, H3, H4, H5, H6, DT tags, which are literal block-level tags and cannot contain other block-level elements.
2. Inline elements
(1) What are the common inline elements?
Common inline elements include < A >, , , , < I >, , < S >, , , < SPAN > etc., among which the < SPAN > tag is the most typical inline element, also known as the inline element.
(2) What are the characteristics of inline elements?
- Elements in adjacent rows are on a single line. Multiple elements can be displayed on a single line
- Height and width Settings are invalid
- Only horizontal inside and outside margins can be set
- The default width is the width of its own content
- Inline elements can only hold text or other inline elements
(3) Attention:
You can’t put a link inside a link.
Special case A can have block-level elements, but it is safest to switch block-level mode for A.
3. Inline block elements
(1) What are the common in-line block elements?
There are several special tags , , < TD > that you can set width, height, and alignment on inline elements, and some sources might call them inline block elements.
(2) What are the characteristics of inline block elements?
- And adjacent inline elements (inline blocks) on a single line, but with gaps between them. Multiple lines can be displayed on a single line.
- The default width is the width of its own content.
- Height, line height, margins, and margins can be controlled.
4. Differences between block-level elements, inline elements and inline block elements
Element model | Elements are arranged | Set the style | The default width | contains |
---|---|---|---|---|
Block-level elements | Only one block element can be placed in a row | You can set the width height | 100% of the container | The container level can contain any tag |
Inline elements | A row can contain multiple inline elements | The width height cannot be set directly | The width of its own content | Holds text or other inline elements |
Inline block elements | Put multiple inline block elements in a row | You can set the width and height | The width of its own content |
Block level elements, inline elements, and inline block elements rotate with each other
- Block transfer:
display:inline
; - In-line rotary block:
display:block
; - Block, inline element conversion to inline block:
display: inline-block
;
js
Prototype and prototype chain
👉👉 In-depth JavaScript series six: Prototypes and prototype chains
Person.prototype.constructor
What is the
Person.prototype.constructor === Person // true
Copy the code
Student: Does the function__ proto __
attribute
let fn = function() {}
// The prototype object for functions (including native constructors) is function.prototype
fn.__proto__ === Function.prototype // true
Copy the code
Functions are created by the Function native constructor, so the Function’s __proto__ attribute points to the Function’s Prototype attribute.
To talk aboutjs
The data type
👉👉 6 interview questions related to JavaScript data types
How to judge the various ways of data type, what are the differences, applicable scenarios
👉👉 Talk about JavaScript data type judgment
Promise
How do I make multiple asynchronous requests at once
Answer: Use promise.all.
Promise.all
What is the return mechanism of
In addition to promise.all, there are several other prototype methods to be aware of.
👉👉 read will, handwritten Promise principle, the most accessible version!!
What if you want one of the requests to fail and not return a result
Answer: Use promise.allselect.
webpack
How much packaging optimization knows
👉👉 Play with Webpack and increase your packing speed by 90%
koa
How do I start a server
const Koa = require('koa');
const app = new Koa();
app.use(async ctx => {
ctx.body = 'Hello World';
});
app.listen(3000);
Copy the code
new koa
What did you do
- Build context
ctx
- Build the onion ring model.
koa
Principle of onion ring model
👉👉 Brief analysis of KOA’s Onion model implementation
koa
Onion rings andexpress
What is the difference between middleware
👉👉 Koa2 vs. Express middleware
Long list optimization, 10,000 data without pagination and lazy loading, how to improve performance
👉👉 backend gives you 100,000 pieces of data at a time, how to gracefully display, in the end to investigate me what?
What happens between the time a data request is initiated and the time the data is received
This I can’t, also did not find what effective data, the hope has big guy to be able to give directions.
csrf
和 xss
What is it, and how can it be avoided
👉👉 briefly XSS and CSRF
How does the front end encrypt the user’s data
A: MD5, I don’t know much about it, I just used MD5 to encrypt the password for login and registration, and I don’t know anything else.
Based on themd5
Improved security
A: MD5 (MD5), I’m just kidding, there is no big guy can give advice.
Company B
The overall summary
Up company B is a kaka, cut a q, no logic, after asking a replaced one, like a machine without feelings questions, not asked project experience related problem, painted with basic interview questions can deal with, as a whole is very simple, this is basically a coder, they can work, pay not to too high.
Interview Questions
let,const,var
What’s the difference?- Iterating over the number group
n
methods - The way
vue
What are the advantages and characteristics - What is virtual
dom
vue
Values are passed between componentsn
Kind of wayvue
What are the built-in instructionsv-show
和v-if
What’s the difference?- How to make
CSS
Only in the current component - How to solve
vue
Initialization page flash problem - What is the
SPA
What are the advantages and disadvantages vue
What are the first screen rendering optimizationsvue
What are the life cycle functions- Which hooks are triggered the first time the page loads
- In which lifecycle the data request is made
vue-router
There are several modelshash
和history
What’s the difference?vuex
What are the propertiesgit
Common commands to know- What issues need to be considered when building a framework for a new project
- How to do permission authentication
- How to do
mock
data
let,const,var
What’s the difference?
(1) Block-level scope: block scope is included by {}, let and const have block-level scope, var does not have block-level scope. Block-level scopes solve two problems in ES5:
- Inner variables may override outer variables
- Loop variables used to count are leaked as global variables
(2) Variable promotion: var has variable promotion, let and const have no variable promotion, that is, variables can only be used after the declaration, otherwise an error will be reported.
(3) Add global attribute: browser global object is window, Node global object is global. Var declares a global variable and adds it as a property of the global object, but let and const do not.
(4) Repeated declaration: when var declares a variable, it can repeat the declaration of the variable, and the variable with the same name declared after will overwrite the traversal declared before. Const and let do not allow variables to be declared twice.
(5) Temporary dead zone: a variable is not available until it is declared with let, const. This is grammatically called a temporary dead zone. Variables declared using VAR do not have temporary dead zones.
(6) Initial value setting: When declaring variables, var and let do not need to set initial values. A const declaration variable must have an initial value.
(7) Pointer to: let and const are new syntax for creating variables in ES6. Let creates variables that can be pointer pointed to (can be reassigned). But const variables are not allowed to change the pointer.
The difference between | var | let | const |
---|---|---|---|
Whether there are block-level scopes | x | ✔ ️ | ✔ ️ |
Whether there is variable promotion | ✔ ️ | x | x |
Whether to add global attributes | ✔ ️ | x | x |
Whether variables can be declared repeatedly | ✔ ️ | x | x |
Is there a temporary dead zone | x | ✔ ️ | ✔ ️ |
Whether the initial value must be set | x | x | ✔ ️ |
Can you change the pointer | ✔ ️ | ✔ ️ | x |
Iterating over the number groupn
methods
👉👉 Do you know the ten higher-order functions commonly used in JavaScript?
The wayvue
What are the advantages and characteristics
-
Progressive frameworks: can be easily introduced in any project;
-
Lightweight framework: Focused only on the view layer, is a collection of views that build data, only tens of KB in size;
-
Easy to learn: Chinese developed, Chinese documents, there is no language barrier, easy to understand and learn;
-
Two-way data binding: Easier data manipulation;
-
Componentization: encapsulation and reuse of logic is realized to a large extent, which has unique advantages in building single page applications.
-
Separation of view, data and structure: it makes it easier to change the data, without the need to modify the logical code, and only need to operate the data to complete the relevant operations;
What is virtualdom
Virtual DOM is an abstract data structure of DOM nodes in JavaScript. The reason why Virtual DOM is needed is that it is expensive to operate DOM in the browser and frequent DOM operation will cause performance problems.
The function of the virtual DOM is to compare the virtual DOM before and after the update and find as few real DOM that need to be updated as possible when the page is re-rendered due to the change of responsive data, so as to achieve the purpose of improving performance.
The realization principle of virtual DOM mainly includes the following three parts:
- with
JavaScript
Object simulation realityDOM
Trees, to the realDOM
To abstract; diff
Algorithm – Compare two virtual treesDOM
Tree differences;pach
Algorithm – Virtual twoDOM
Object differences apply to realDOM
The tree.
vue
Values are passed between componentsn
Kind of way
(1)props / $emit
Applicable to parent-child component communication
(2)ref
Applicable to parent-child component communication
ref
: If in ordinaryDOM
Element, the reference points toDOM
Elements; If used on a child component, the reference refers to the component instance
(3)$parent
/ $children
/ $root
: Accesses the parent/child/root instance
(4)EventBus ($emit / $ON)
It is suitable for communication between father-child, intergenerational, and sibling components
This approach uses an empty Vue instance as the central event bus (event hub), which triggers events and listens for events to communicate between any component, including parent, generational, and sibling components.
(5)$attrs
/$listeners
It is suitable for intergenerational component communication
$attrs
: contains the parent scopeprop
The property bindings identified (and obtained)class
和style
Except). When a component does not declare anyprop
This contains all the bindings of the parent scope (class
和style
Except), and can passv-bind="$attrs"
Pass in internal components. Usually cooperateinheritAttrs
Option used together.$listeners
: contains objects in the parent scope.native
Modifier of)v-on
Event listeners. It can go throughv-on="$listeners"
Passing in internal components
(6)provide / inject
It is suitable for intergenerational component communication
Ancestor components provide variables through provide, and descendant components inject variables through inject. Provide/Inject API mainly solves the communication problem between cross-level components, but its usage scenario is mainly that sub-components obtain the state of the upper level components, and a relationship between active provision and dependency injection is established between cross-level components.
(7)Vuex
It is suitable for communication between father-child, intergenerational, and sibling components
Vuex is a state management mode developed specifically for vue.js applications. At the heart of every Vuex application is the Store. A Store is basically a container that contains most of the states in your app.
Vuex
State storage is reactive. whenVue
Components fromstore
When the state is read, ifstore
When the state changes, the corresponding components are updated efficiently.- change
store
The only way to commit state in is explicitly(commit) mutation
. This allows us to easily track each state change.
(8) Slots
Vue3 can obtain slot data through usesolt.
(9)mitt.js
Applicable to any component communication
Vue3 removes $on, $off and other methods, so EventBus is no longer used. The corresponding replacement scheme is mitt.js
vue
What are the built-in instructions
v-show
和 v-if
What’s the difference?
-
Means: V-if is a dynamic way to add or remove DOM elements to the DOM tree; V-show controls explicit and implicit by setting the DOM element’s display style attribute.
-
Compilation process: The V-IF switch has a partial compile/uninstall process in which internal event listeners and subcomponents are destroyed and rebuilt as appropriate; V-show is simply a CSS-BASED switch;
-
Compile conditions: V-if is lazy, and if the initial condition is false, nothing is done; Partial compilation starts only when the condition is true for the first time; V-show is compiled under any condition, whether the first condition is true or not, and then cached, with DOM elements preserved;
-
Performance cost: V-IF has higher switching cost; V-show has a higher initial render cost;
-
Usage scenario: V-IF suitable for operating conditions is unlikely to change; V-show is suitable for frequent switching.
How to makeCSS
Only in the current component
Add scoped to the style tag in the component
How to solvevue
Initialization page flash problem
When using VUE development, before vUE initialization, div is not owned by VUE, so the code we write will be prone to screen failure before parsing, and we will see words like {{message}}, although this time is usually very short. But we still need to solve this problem.
First: cloak the CSS with [v-cloak] {display: none; }. If the problem is not completely resolved, add style=”display: none;” to the root element. :style=”{display: block }”
What is theSPA
What are the advantages and disadvantages
SPA loads the corresponding HTML, JavaScript, and CSS only when the Web page is initialized. Once the page is loaded, SPA will not reload or jump the page because of the user’s operation. Instead, routing mechanisms are used to transform HTML content, interact with the user and avoid page reloading.
Advantages:
- User experience is good, fast, content change does not need to reload the whole page, avoid unnecessary jump and repeated rendering;
- It is conducive to the separation of responsibilities at the front and back ends, with clear architecture. The front end carries out interactive logic, and the back end is responsible for data processing.
Disadvantages:
- Time-consuming initial loading: to achieve a single page
Web
Application functions and display effects need to be changed when the page is loadedJavaScript
,CSS
Unified loading, part of the page on demand loading; - Is not conducive to
SEO
: Because all content is displayed in a dynamic replacement page, so inSEO
It has a natural weakness.
vue
What are the first screen rendering optimizations
- Image compression/lazy loading
- To disable
.map
file - Route lazy loading
cdn
Introducing a common library- open
GZIP
The compression
vue
What are the life cycle functions
Vue’s lifecycle hook core implementation uses the publish-subscribe model to subscribe to the lifecycle hooks passed in by the user (stored in an array internally) and then executes the corresponding hook method (published) once during the creation of the component instance.
beforeCreate
Is:new Vue()
Then the first hook is triggered in the current phasedata
,methods
,computed
As well aswatch
The data and methods on the.created
: occurs after the instance has been created, the current phase has completed the data observation, i.e. the data can be used, the data can be changed, the change data is not triggered hereupdated
Function. You can do some initial data acquisition, which is not available at this stageDom
And interact, if you want to, throughvm.$nextTick
To access theDom
.beforeMount
: occurs before mount, before thistemplate
The template has been imported into the rendering function for compilation. The current phase is virtualDom
It has been created and is about to start rendering. Changes can also be made to the data at this point without triggeringupdated
.mounted
: occurs after the mount is complete, in the current phase, trueDom
After the mount is complete, the data is bidirectional bound and can be accessedDom
Node, using$refs
Properties ofDom
Perform operations.beforeUpdate
: occurs before an update, that is, reactive data is updated, virtualdom
Before rerendering is triggered, you can make changes to the data in the current phase without causing rerendering.updated
: Occurs after the update is complete for the current phase componentDom
The update is complete. It is important to avoid changing the data during this period, as this may result in an infinite loop of updates.beforeDestroy
: occurs before the instance is destroyed, and the instance is fully usable in the current phase, at which point we can clean up the mess, such as clearing timers.destroyed
: occurred after the instance was destroyeddom
Empty shell. Components have been disassembled, data bindings removed, listeners removed, and subinstances destroyed.
Which hooks are triggered the first time the page loads
BeforeCreate, created, beforeMount, Mounted
In which lifecycle the data request is made
You can call hook functions created, beforeMount, and Mounted because in these three hook functions, data is already created and can be assigned to the data returned by the server.
It is recommended that asynchronous requests be called in the created hook function, which has the following advantages:
- Faster access to server data and fewer pages
loading
Time; ssr
Does not supportbeforeMount
、mounted
Hook function, so putcreated
Chinese contributes to consistency;
vue-router
There are several models
Vue-router has three routing modes: hash, history, and Abstract.
- hashUse:
URL hash
Value for routing. Supported by all browsers, including not supportedHTML5 History Api
Browser; - history: rely on
HTML5 History API
And server configuration. - abstract: Support all
JavaScript
Operating environment, such asNode.js
Server side. If you find no browserAPI
Routes are automatically forced into this mode.
hash
和 history
What’s the difference?
(1) Implementation principle of hash mode
Early implementations of front-end routing were based on location.hash. The principle is simple: the value of location.hash is what comes after the # in the URL. For example, here’s a website whose location.hash value is #search:
https://www.word.com#search
Copy the code
The hash routing mode is implemented based on the following features:
URL
中hash
Value is just a state on the client side, which means that when a request is made to the server side,hash
Parts will not be sent;hash
Any change in value adds a record to the browser’s access history. So we can control it through the browser’s back and forward buttonshash
The switch;- Can be achieved by
a
Tag and sethref
Property, when the user clicks on this TAB,URL
的hash
The value will change; Or useJavaScript
Come to the rightloaction.hash
Assign, changeURL
的hash
Value; - We can use
hashchange
Event to listenhash
Value to jump to (render) the page.
(2) The realization principle of history mode
HTML5 provides the History API to implement URL changes. The two main apis are history.pushstate () and history.repalcestate (). Both apis allow you to manipulate the browser’s history without refreshing it. The only difference is that the former is to add a history, while the latter is to replace the current history directly, as shown below:
window.history.pushState(null.null, path);
window.history.replaceState(null.null, path);
Copy the code
The history routing pattern is implemented based on the following features:
pushState
和repalceState
twoAPI
To operate the implementationURL
The change of the;- We can use
popstate
Event to listenurl
To jump to the page (rendering); history.pushState()
或history.replaceState()
Not triggerpopstate
Event, at which point we need to manually trigger the page jump (render).
vuex
What are the properties
There are five kinds, respectively
- State: Data structure that defines the State of the application, where the default initial State can be set.
- Getter: Allows components from
Store
To obtain data from,mapGetters
The auxiliary function is just going to bestore
In thegetter
Map to local computed properties. - Mutation: is the only change
store
And must be a synchronization function. - Action: for submission
mutation
, rather than changing state directly, can include any asynchronous operation. - Module: allows to be single
Store
Split into multiplestore
And simultaneously stored in a single state tree.
git
Common commands to know
👉👉 Git command quick reference table
What issues need to be considered when building a framework for a new project
👉👉 combine code practice, learn front-end engineering comprehensively
How to do permission authentication
A: Permission authentication based on url address and token is performed in the route guard.
How to domock
data
A: You can use mock.js
C company
The overall summary
C company should first apply for an interview online, and then fill in a very long and long application form, and then fill in a very long and long questionnaire, the content of the questionnaire is like the public psychological assessment, has nothing to do with technology. Then I was asked to go to the company for an interview. The interview was conducted on the computer, and the questions had been sorted out below. Generally speaking, it was not difficult. Then the written test finished, and gave me a set of primary school Olympians, can not use the equation solution, this is true a little pit, this should have an interview link, but I was killed in the written test link, also don’t know what is behind.
Interview Questions
ajax
What is? What are the advantages and disadvantages?- The difference between synchronous and asynchronous
- How to solve cross-domain problems
WEB
The application actively pushes from the serverData
How to get to the client- What are some common browser compatibility issues? What’s the reason? How to solve
- What are the common ones
hack
skills - What’s your experience with front-end development performance optimization
- Talk to you about
webpack
View of the - What are the advantages and disadvantages of mainstream front-end frameworks
- Which framework do you like best and why
- How to eliminate duplicate elements in an array
css
How to achieve a slide effect- Handwritten form
ajax
What is? What are the advantages and disadvantages?
Ajax is a technology for creating interactive web applications.
Advantages:
- Implement local update (without refresh state),
- Reduces the server-side stress
Disadvantages:
- Broke the browser forward and backward mechanism (because
ajax
Automatic update mechanism) ajax
If you have too many requests, the page will load slowly.- Search engine support is low.
ajax
The security problem is not very good (can be solved with data encryption).
The difference between synchronous and asynchronous
Synchronization: The idea of synchronization is that all operations are completed before being returned to the user. In this way, the user waits too long online, giving the user a feeling of being stuck (that is, in the system migration, click the migration, the interface will not move, but the program is still executing, the feeling of being stuck). In this case, the user cannot close the interface; if so, the migration process is interrupted.
Async: Put the user request into a message queue and report back to the user that the migration process has started and you can close the browser. Then the program slowly writes to the database. That’s asynchrony. But the user doesn’t feel stuck and will tell you that your request has been answered. You can close the screen.
How to solve cross-domain problems
👉👉 Nine Cross-domain implementations (full version)
WEB
The application actively pushes from the serverData
How to get to the client
- polling
- WebSocket
What are some common browser compatibility issues? What’s the reason? How to solve
Since my company is a company dedicated to building user habits, when it comes to compatibility problems, please download the latest version of Google Browser 😝, so I have no actual experience with this, only know Babel and PostCSS.
What are the common oneshack
skills
To tell you the truth, no.
What’s your experience with front-end development performance optimization
👉👉 24 Suggestions for Front-end Performance Optimization (2020)
Talk to you aboutwebpack
View of the
👉👉 What does Webpack want to know when the interviewer asks him
What are the advantages and disadvantages of mainstream front-end frameworks
Use vUE only, the advantages mentioned above, the disadvantages, may not support IE8.
Which framework do you like best and why
Same as the previous question.
How to eliminate duplicate elements in an array
set
reduce
The for loop
- There’s a bunch of ways you can do this, but the idea is to compare two arrays and just put them in.
css
How to achieve a slide effect
👉👉 use CSS to achieve a simple slide show effect
D company
The overall summary
This interview process is very easy, the interviewer is an architect, in high level, do not ask eight-part essays, he give me a few real-life scenarios, and then into the logic of the code, to make me realize, he asked a few questions in total, does not need to be on the back of the paper, by have been chasing the asked me a question, and then also will continue to guide me, tip me, Until I couldn’t answer anything.
Interview Questions
- How do you usually request the back end interface?
- What kind of information does your backend have to give you in order for your request to succeed?
- What is the format of the request parameters?
- How to pass a file to the back end?
- How do you understand front-end engineering?
- To buy a computer, look
A
借1k
To findB
借2K
To findC
借3K
, take 6000 yuan to buy a computer, abstract into the front end of the logic is to request different interfaces to obtain data, get all the data after display, this how to achieve? - Do not use
promise.all
,async/await
How do you do that? promise.all
和async/await
What’s the difference?promise.all
What problem is it to solve?- If you have an indefinite number of people, the first person goes to the supermarket to buy something, the second person goes to buy something when the first person comes back, and the third person goes to buy something when the second person comes back. (What he wanted to hear was recursion, so I explained the onion ring principle.)
- How do you remove event listeners? An element is bound to multiple events. How do you determine which one to remove?
- How do you debug code? (This is when you open up the Google console and talk about what each feature can do.)
- What features do you use in Google Debugger?
- How to debug breakpoints?
- What does the console do?
- How do I find the code where the interface resides in an unfamiliar project?
- What if the interface address is dynamic, returned by the other interface?
LocalStorage, session, cookie
What is the difference between?- Then I asked about some of my own open source projects
- Because I brought my computer, I looked at my code
How do you usually request the back end interface?
I don’t know what the interviewer is trying to ask you. I just refer to the interface documentation to make a request.
What kind of information does your backend have to give you in order for your request to succeed?
- Request way
- Request parameters
What is the format of the request parameters?
👉👉 Three formats of HTTP request parameters
Query String Parameters
Form Data
Request Payload
How to pass a file to the back end?
👉👉 Process and method of uploading front-end and back-end files
How do you understand front-end engineering?
👉👉 combine code practice, learn front-end engineering comprehensively
How to realize the example of buying a computer mentioned above?
Answer: Use promise.all or async/await.
Do not usepromise.all
, async/await
How do you do that?
I don’t know 😭😭.
promise.all
和 async/await
What’s the difference?
A: Async Await is based on a Promise implementation, which is a modified promise that makes code look more concise and asynchronous code behaves like synchronous code.
promise.all
What problem is it to solve?
Answer: Summarize the results of a large number of asynchronous operations.
How do you remove event listeners? An element is bound to multiple events. How do you determine which one to remove?
Element. The removeEventListener (type, the handler,false/true)
Copy the code
- Type: indicates the event type
- Handler: Function triggered by event execution
- false/true:
false
As the bubble,true
To capture, the parameter istrue
, indicating that the event handler is invoked during the capture phase;If it is false
To invoke the event handler during the bubbling phase.
It is important to note that listening events cannot be eliminated by anonymous functions, only by real-name functions.
How do I find the code where the interface resides in an unfamiliar project?
A: You can search for the address of the interface.
LocalStorage, session, cookie
What is the difference between?
👉👉 Understand the differences between cookie, session, localStorage, and sessionStorage
E company
The overall summary
This completely don’t need to go, just as lightning protection, first of all, he floor is broken in this company, the company’s internal very broken, like a pyramid sales dens, and then he interviewer is not a technical, don’t know what is a head, ask questions and technology do not have what relation, because see the office environment don’t want to continue, so no sound recording, also didn’t ask any questions, will soon be over.
In fact, E company is not what experience, just remind everyone before looking for a job must first look at the target company’s environment, scale, etc., from the root to avoid stepping on thunder like me.
F
The overall summary
The two interviewers of F company took turns to ask questions, and basically they did not ask questions in eight-part essay. Most of them asked about project experience, so long as it was real work experience, they could basically deal with it. Then they asked some questions about my own open source project, which was based on my resume and would not have been asked if it had not been written. The first interviewer felt that he was talking to himself all the time, while I was talking to myself all the time. The second interviewer would ask for some basic knowledge based on my answers when asking about the project, which was sorted out below.
Interview Questions
Interviewer 1:
- I saw you dig for gold. Give me a quick description
call
.apply
.bind
What are the differences and application scenarios? (As if he wouldn’t ask if I didn’t write) - What about the box model?
- What functions are the company’s projects responsible for?
- Have forms and tables been encapsulated?
- How is a form wrapped?
- How to deal with big data forms,
select
When there are too many options? (Optimization problem) - By the end
vue3
Any ideas?nuxt
What do you think? - Have you ever built your own scaffolding?
- Then it’s about the project
Interviewer 2:
- What do you do in the company? What is the project about?
- Then it’s about the project
vue2
和vue3
What’s the difference?- Did you encounter performance tuning issues?
- From the input
url
What happens between the time the page is rendered? - Do you know how browsers work?
http
What are the status codes?- How does the front end handle these status codes?
localStorage
.session
.cookie
What is the difference between?- Front-end security issues,
CSRF
.XSS
- How to solve cross-domain problems?
- The cross-domain problem actually changes
http
What parameter is in it?
call
.apply
.bind
What are the differences and application scenarios
👉👉 do you know how to call, apply, and bind? Well, can you write one by hand?
Talk about the box model
👉👉 CSS box model and margin negative value
By the endvue3
Any ideas?nuxt
What feeling
A: VuE3 can better complete the reuse of structure and logic at the code writing level. Nuxt is a framework of convention more than configuration, many things have been encapsulated, according to the convention to write can be conducive to team collaboration.
vue2
和 vue3
What’s the difference?
- Response principle
- Lifecycle hook name
- Custom instruction hook name
- New built-in components
diff
algorithmComposition API
Have you encountered performance optimization problems
👉👉 24 Suggestions for Front-end Performance Optimization (2020)
From the inputurl
What happens between the time the page is rendered
👉👉 The most detailed classic interview question ever what happens from entering the URL to seeing the page?
You know how browsers work
👉👉 Have an in-depth understanding of how browsers work
http
What are the status codes
The first digit of the status code determines the different response states, as follows:
- 1: message
- 2 indicates success.
- 3 indicates redirection
- 4 indicates that the request is incorrect
- 5 indicates a server error
1xx
Represents that the request has been accepted and needs to continue processing. This type of response is a temporary response that contains only the status line and some optional response information and ends on an empty line
Common ones are:
100
(The client continues to send the request, which is a temporary response.) This temporary response is used to inform the client that some of its requests have been received by the server and have not yet been rejected. The client sends the rest of the request on demand, or ignores the response if the request is completed, and the server must send a final response to the client when the request is complete101
The server switches protocols based on client requestswebsocket
或HTTP2
upgrade
2xx
Indicates that the request has been successfully received, processed, and accepted by the server
200
(Success) The request is successful, and the desired response header or data body is returned with the response201
The request succeeded and the server created a new resource202
The (created) server has accepted the request but has not yet processed it203
(Unauthorized information) The server successfully processed the request, but the information returned may have come from another source204
(No content) The server successfully processed the request, but did not return any content205
(Reset content) The server successfully processed the request, but did not return any content206
The server successfully processed part of the request
3xx
Indicates that further action is required to complete the request, and typically these status codes are used for redirection
300
(Multiple options) The server can perform multiple operations on a request.301
(Permanent move) The requested page has been permanently moved to the new location.302
The (temporarily mobile) server is currently responding to requests from web pages in different locations, but the requester should continue to use the original location for future requests303
Requesters should use separate for different locationsGET
The server returns this code when requested to retrieve the response305
(Using a proxy) The requester can only access the requested web page using a proxy.307
(Temporary redirection) The server currently responds to requests from web pages in different locations, but the requester should continue to use the original location for future requests
4xx
Represents that the client appears to have made an error that interferes with the server’s processing
400
The server does not understand the syntax of the request401
The (unauthorized) request requires authentication.403
The server rejects the request404
The server could not find the requested page405
(method disable) Disables the method specified in the request406
(not accepted) A web page that cannot respond to a request using the requested content feature407
Proxy authorization is required401
(unauthorized) similar, but the designated requester should authorize the use of the proxy408
(Request timeout) The server timed out while waiting for a request
5xx
Indicates that the server is unable to complete an obviously valid request. This type of status code indicates that an error or exception has occurred while the server is processing the request
500
(Server internal error) The server encountered an error and could not complete the request501
(Not implemented) Server The server does not have the function to complete requests502
(Error Gateway) The server acting as a gateway or proxy received an invalid response from the upstream server503
The server is currently unavailable, (due to overloading or downtime for maintenance)504
(Gateway timeout) The server acted as a gateway or proxy, but did not receive the request from the upstream server in time505
(HTTP
Version not supported) the server does not support the version used in the requestHTTP
Protocol version
How does the front end handle these status codes
A: In AXIos request interception, different operations are performed based on different status codes.
localStorage
.session
.cookie
What is the difference between
👉👉 Understand the differences between cookie, session, localStorage, and sessionStorage
Front-end security issues,CSRF
.XSS
👉👉 briefly XSS and CSRF
How to solve cross-domain problems
👉👉 Nine Cross-domain implementations (full version)
The cross-domain problem actually changeshttp
Which parameter is inside
A: the Access – Control – Allow – Origin? This is not sure, there is a big man can give advice.
G company
The overall summary
At the beginning, COMPANY G showed me a design drawing and asked me to conduct the layout on site. It was very simple, including one header and one SIDER, as well as a content area. The content area had a two-column layout, which was quite simple. Then according to the project written on my resume, I will ask several companies, ask several of my own open source, during which I will intersperse some relevant knowledge points, which have been sorted out below.
Interview Questions
- Showed the blueprints, let the site layout
localStorage
.session
.cookie
What is the difference betweenvuex
的mutation
和action
vuex
modular- Array deep copy
css
The box modelcss
Achieve zebra crossing effect- Cross-domain problem
localStorage
.session
.cookie
What is the difference between
👉👉 Understand the differences between cookie, session, localStorage, and sessionStorage
vuex
的 mutation
和 action
👉👉 [Beginner’s Notes] Learn to use Vuex
vuex
modular
👉👉 [Beginner’s Notes] Learn to use Vuex
Array deep copy
👉👉 deep and shallow copy of JavaScript, how to write deep copy?
css
The box model
👉👉 CSS box model and margin negative value
css
Achieve zebra crossing effect
A: You can use pseudo-elements, where the parent element uses absolute positioning, and pseudo-elements use relative positioning, which is the same size as the parent element and overlaps in position. Use nTH-Child selector to select odd lines, only to set the odd line pseudo-elements can be achieved.
Cross-domain problem
👉👉 Nine Cross-domain implementations (full version)
H company
The overall summary
It seems that H company is not sincere in recruiting. The interviewer asked me a few symbolic questions and told me to go home and wait for the news. The questions were very basic and of little reference significance.
We don’t know whether it is the year-end performance brushing, or whether it means that I have hired enough people before I come, but I have already made an interview and I am embarrassed to break the appointment. Have you had similar experience?
Interview Questions
es6
What are the new featurespromise
What are the methods- Iterating over the number group
n
methods vue
The life cyclewatch
和computed
Distinguish and use scenariosvue3
和vue2
The difference between- virtual
dom
And the realdom
The difference between - The component passes a value
n
Kind of way ts
和js
The advantages and disadvantages of
es6
What are the new features
👉👉 Nguyen Yifeng ES6 Tutorial
promise
What are the methods
👉👉 read will, handwritten Promise principle, the most accessible version!!
Iterating over the number groupn
methods
👉👉 Do you know the ten higher-order functions commonly used in JavaScript?
vue
The life cycle
B company in the interview questions answered.
watch
和 computed
Distinguish and use scenarios
The Computed:
- It supports caching and recalculates only when the dependent data changes
- Asynchrony is not supported when
Computed
Cannot listen for data changes when there are asynchronous operations in - If an attribute is computed by something else, and the attribute depends on something else, you usually use computed
- if
computed
Attribute whose attribute value is a function, is used by defaultget
Method, the return value of the function is the property value of the property; incomputed
In, the attribute has oneget
Methods and aset
Method, which is called when data changesset
Methods.
To Watch:
- It does not support caching, and when a property changes, it triggers the corresponding action
- Support asynchronous listening
- The listening function takes two arguments, the first the most recent value and the second the previous value
- The listening data must be
data
Declared in or passed by the parent componentprops
When the data changes, other operations are triggered - The function takes two arguments:
- Immediate: The callback function is triggered immediately after the component is loaded
- Deep: Detects changes within data, used in complex data types, such as changes to objects in an array.
vue3
和 vue2
The difference between
It was answered in the interview question of F company.
virtualdom
And the realdom
The difference between
- virtual
DOM
No typesetting or redrawing - virtual
DOM
Is to take the truthDOM
convertJavascript
code - virtual
DOM
Make frequent changes, then compare and change the reality once and for allDOM
The parts that need to be changed, and finally in realityDOM
For typesetting and redrawing, reduce too muchDOM
Node typesetting and redraw loss
The component passes a valuen
Kind of way
B company in the interview questions answered.
ts
和 js
The advantages and disadvantages of
ts
是js
The superset that you can set ints
Using native injs
Syntax.ts
Statically compiled, it provides strong typing and more object-oriented content.ts
You still end up compiling to weakly typed, object-based nativejs
, and then run.
I,
The overall summary
Explanation: this quite the rules of the bar, most are also online interview questions, but he will continue to ask in-depth questions according to your answer, rather than brainless question of the kind, did not ask the project. But he and the above wenhua finance and economics similar, to fill in a very long very long information, and then do a set of logical thinking questions unrelated to the code, and then interview, more trouble.
Interview Questions
- The box model
- Method of centralizing elements horizontally and vertically
flex
和grid
What’s the difference?Flex: 1.
What does that mean?- One parent container, three children, the two sides of the child container width fixed, the middle adaptive, how to achieve?
- Let’s talk about closures and currization of functions
- Explain the event loop. What are microtasks and macrotasks?
- Explain the prototype chain
- Do all objects have prototypes?
vue
Life cycle of- Cross domain, solution to cross domain problem
- The way
sourcemap
What are the configurations and how do you choose between development and production environments? - Browser input from
url
What happens between page rendering?
The box model
👉👉 CSS box model and margin negative value
Method of centralizing elements horizontally and vertically
👉👉 12 types of CSS with fixed width and height and 29 types of CSS with fixed width and height.
flex
和 grid
What’s the difference?
👉👉 take a look at the beauty of flex layout with 48 mini images “Once and for all”
👉👉 The most powerful CSS layout – Grid layout
Flex: 1.
What does that mean?
👉👉 take a look at the beauty of flex layout with 48 mini images “Once and for all”
One parent container, three children, the two sides of the child container width fixed, the middle adaptive, how to achieve?
flex
layoutgrid
layout+ calc
Let’s talk about closures and currization of functions
👉👉 learning JavaScript closures for the first time
👉👉 “front-end advancements” thoroughly understand the function currification
Explain the event loop. What are microtasks and macrotasks?
👉👉 Do some GIFs and learn about EventLoop
Explain the prototype chain
👉👉 In-depth JavaScript series six: Prototypes and prototype chains
Do all objects have prototypes?
A: No, objects created with object.create (null) have no prototypes.
vue
Life cycle of
B company in the interview questions answered.
Cross domain, solution to cross domain problem
👉👉 Nine Cross-domain implementations (full version)
The waysourcemap
What are the configurations and how do you choose between development and production environments?
👉👉 What does Webpack want to know when the interviewer asks him
Browser input fromurl
What happens between page rendering?
👉👉 The most detailed classic interview question ever what happens from entering the URL to seeing the page?
J company
The overall summary
J company has three interviewers, one of whom should be HR to ask some questions unrelated to technology, and the other two to ask technical questions. It seems that the level is very high.
I know a lot about your resume. Scared me into saying I know.
Then began to ask questions, there are basic, most are rare, also blame my resume wrote a lot of “familiar”, a few questions later I said, I have a new understanding of “familiar”.
This because the interviewer came in more suddenly, did not have time to record, plus at that time was really asked meng lived, did not remember a few questions, but in fact more than the following these, and most are source code, principle of what… No question item
Interview Questions
- I see you do
vue
Tell me about itvue
Template compilation principle vue
Why use ittemplate
啊- Something about
vuex
The mount process of - Something about
vue-router
Several modes and guards bar nuxt
How do I configure a route? How do I define a route? Which route has a higher prioritypromise
What methods have you usedexpress
和koa
What’s the difference?ts
跟js
What’s the difference? Pros and cons
I see you dovue
Tell me about itvue
Template compilation principle
👉👉 Vue template compilation principles
vue
Why use ittemplate
啊
A: I’m talking about writing more like native HTML.
Something aboutvuex
The mount process of
How is 👉👉 Vuex’s store mounted into each component
Something aboutvue-router
Several modes and guards bar
Patterns were covered earlier
👉👉 how many hook functions does vue-router have? What is the specific and what is the implementation process?
nuxt
How do I configure a route? How do I define a route? Which route has a higher priority
A: NuXT automatically generates routes based on file paths, not custom routes.
promise
What methods have you used
👉👉 read will, handwritten Promise principle, the most accessible version!!
express
和 koa
What’s the difference?
1. Grammatical differences
experss
Use callbacks asynchronouslykoa1
Asynchronous usegenerator + yeild
koa2
Asynchronous useawait/async
2. Middleware differences
koa
Onion model, sequential execution, reverse execution, supportcontext
To transfer dataexpress
The onion model is not supported. Plug-ins need to be introducedcontext
3. Integration difference
express
Built in a lot of middleware, high integration, easy to usekoa
Lightweight and simple, easy to customize
ts
跟 js
What’s the difference? Pros and cons
ts
是js
The superset that you can set ints
Using native injs
Syntax.ts
Statically compiled, it provides strong typing and more object-oriented content.ts
You still end up compiling to weakly typed, object-based nativejs
, and then run.
High frequency problems
High frequency is not actually, because only interviewed ten companies, sample size is too small, but the topic of several appear many times, so the visible is quite hot, combined with the actual interview, sorting out the relatively high frequency of interview questions, you can see, emphatically even look not to understand, is not interested in, also want to force yourself to back up.
CSS
The box model- Some common page layouts to know
es6
New feature, traversal number groupsn
methodsJS
Prototype and prototype chaints
跟js
What are the differences, features, advantages and disadvantagespromise
And its prototype method- Browser input from
url
What happens between page rendering - What is a cross-domain problem and how can it be resolved
- Front-end safety issues
- If you write about yourself
node
“May askexpress
和koa
Related issues of webpack
To optimize the
There is own project must understand, although may indeed be yourself, but after a long time will forget, suggest the interview before his project to look again, most companies will take up a certain time to ask you before you is responsible for the project, answer for the big probability will make the interviewer feel you project experience is compiled, or not to write their own, Points are deducted.
Essential question
Finally summarized several non-technical questions often asked by the interviewer, you can prepare in advance, so as not to get stuck on the spot, incoherent words to leave a bad impression on the interviewer.
- Make a brief introduction about yourself
- Why did you leave your last company
- What do you think of what the last company did
- Why the front end
- How do you usually study
- What books have you read?
- What do you think are your strengths/weaknesses
- Give an example of someone who is willing to learn
- What you think about your career
- Is there anything else you want to ask me
Make a brief introduction about yourself
Mainly introduce their work content, technology stack, a little bit of interest and hobbies can also be.
Why did you leave your last company
The two main reasons I answer are that one is to learn more and the other is the old salary question.
What do you think of what the last company did
Give a general compliment about the company and then talk about the reasons why you don’t want to stay. Don’t hold a teasing meeting and complain about this or that. For example, I think the previous company has done a good job in all aspects, including the corporate environment, management system and team atmosphere. However, the update of technology stack is slow and the salary adjustment system is not ideal.
Why the front end
Think the front end is more interesting, you can see the interface, you can do something fun, show off to parents, children and girlfriends.
How do you usually study
Read paper books, e-books, videos, and blog forums.
What books have you read?
Tell what you see, don’t make it up. I’ve heard interviewers ask you crazy questions like what color the cover of a book is or what the contents of a book are.
What do you think are your strengths/weaknesses
The advantage lies in active learning and willingness to share. Deficiency is not interested in the content of learning, such as database.
Give an example of someone who is willing to learn
Outstanding writer in nuggets community
The company’s annual progress award
What you think about your career
Four words, forced case came up directly, a special many fine.
Is there anything else you want to ask me
I usually ask about the size of the technical team
- There are a few people on the technical team,
- A couple of front ends,
- A couple of back ends,
- How many are advanced, intermediate and elementary
Then there is the technology stack
- What technology stack is currently in use
- What technology stack do you plan to use in the future
- Whether they can determine the future of the technology stack
Then there’s your role in the team
- What’s your job?
- Degree of decision for the project
Recommended practice
I recommend you a few commonly used brush interview questions website.
👉👉 AN interview column from a warbler
👉👉 2021 Latest Front end Questions
👉👉 take a look at the beauty of flex layout with 48 mini images “Once and for all”
👉👉 The most powerful CSS layout – Grid layout
👉👉 set of interview questions
👉👉 2021 my front-end interview preparation
👉👉 front-end interview questions
👉👉 Jsliang Job Search series
👉👉 [my 🐯 year interview preparation] Vue got it right
After the language
Finally, I wish everyone in the New Year, can find satisfactory work, promotion and pay, earn pot full pot full!