preface
Before the delivery of Tencent intern front guard, there has been no phone, checked the status said not appropriate, thought cool, today received a phone, unexpected… The interviewer said it wouldn’t take too long, maybe 30 minutes, and the whole process lasted about 30 minutes.
Here’s how the interview goes:
To introduce myself
- I briefly introduced my school and major, as well as the learning process.
Is it possible to work in Shenzhen (Guangzhou in the resume intention)
JavaScript scope? How many kinds of
- Global scope
- Function scope
Q: Does JavaScript have block-level scope
A: There was no block-level scope before ES5, but ES6 introduced the concept
Difference between let and VAR
- Var can be repeated; let cannot
- Variable scope of LET is different, and there is no variable promotion
Q: Anything else
A:…
How much ES6 knows and what features it has used
- I briefly talked about some of the features I’ve used
- Arrow function
- Template string
- Class
- module
- Object to deconstruct
- Promise
- .
Promise, you know? How many states there are
- Three states:
- pending
- fulfilled
- reject
- Two processes:
- pending -> fulfilled
- pending -> rejectd
Q: When does a promise enter a catch ANSWER: When pending is rejectd
Tell me about the React project on your resume
- Briefly describe the items on your resume
What is the react lifecycle
- Initialize the
- constructor
- getInitialProps
- getDefaultState
- componentWillMount
- render
- componentDidMount
- The update process
- componentWillReceiveProps
- shouldComponentUpdate
- componentWillUpdate
- render
- componentDidUpdate
- Unloading process (this is not answered)
- componentWillUnmount
When will use componentwillreceiveprops
- Didn’t use much, didn’t answer
- Online interpretation
Have you used build tools? What is the loader for Webpack?
- Webpack was used in the project
- Loader is used to compile and process resources
Q: Have you used any other build tools?
A: No… (gg)
What is the difference between Vue and React
- Open questions, free play
The principle of vUE two-way data binding
- The realization is based on
Object.defineProperty
- In addition, the published-subscriber model, mainly Observer, Dep, Watcher, etc
Is the Ajax used in the project native, or is there a library used?
- It’s all using packaged libraries, and it’s mostly using
axios
HTTP status code?
- 2xx, 3xx, 4xx, 5xx, respectively
- Here we say 304, and we have the following HTTP cache
When is the 304 status code returned?
- This is a complicated question. Here is an Etag
- ETag is a product of HTTP1.1. The server uses an algorithm to calculate a unique identifier for the resource, which may be the MD5 value of a resource. In response to the resource to the client, it will add “ETag: value “at the entity head, and return it to the client
- The client saves this field and brings it to the server with the next request. The server accepts the ETag value from the client and compares the ETag value to determine whether the resource has been modified relative to the client
- If a match is made, the server returns a 304 status code and tells the client to use the local cache directly, otherwise the resource is returned in the normal GET200 form
- Corresponding header field
- If None – Match: ETag – value
- If – Match: ETag – value
- There is another kind is the following question
Last-Modified
What is the difference between HTTP caching, cache-Control and eTAG
- Here although answer, but the feeling also answer is not very good
- The header of cache-control has many fields
- If the Cache set by cache-control has not expired, it can be read from the local Cache and return 200 (from Cache), without making a request to the server
- Using ETag sends a request to the server. After verification, the server decides whether to return the resource
- .
Except for etag, last-Modified, okay?
- I didn’t answer that. I forgot
- When the server passes a resource to the client, it returns the Last Modified time of the resource to the client in the form of “last-modified: GMT” at the head of the entity
- The client marks the information on the resource and returns the information in the request packet to the server for the next request. The server checks the information. If the modification time of the resource on the server is the same, the resource has not been modified and directly returns the 304 status code without returning the content
- Corresponding header field
- If-Modified-Since: Last-Modified-value
- If-Unmodified-Since: Last-Modified-value
What is the cross-domain approach?
- JSONP
- CORS
- Server agent
- and more then…
How does JSONP work?
- using
script
Tags support cross-domain properties, including a script tag that retrieves the method that wraps the data (equivalent to returning a piece of JAVASCRIPT code), including a callback in the request, which the server returns after injecting parameters, and the script tag that takes the returned JAVASCRIPT code to run the cross-domain callback directly.
Can JSONP make post requests? Why is that?
- Does not support
- Because script tags only support GET requests…
What is the difference between cookies and localStorage?
- Cookie data size cannot exceed 4K
- Cookies are passed back and forth between the server and client
- Cookies can set many attributes, max-age, Path, Expires, etc
- LocalStorage stores persistent data. Data is not lost after the browser is closed unless the data is deleted
- LocalStorage stores more data
Q: Anything else
A:… (gg)
Describe the box model of CSS
- I talked about the standard box model and the weird mode
What are the methods to achieve vertical horizontal center
- flexbox
- Absolute positioning +margin negative (known width and height)
- Absolute positioning + Transfrom negative (unknown width height)
- Top left right bottom 0 + Margin Auto
Margin Auto 0 + margin Auto 0 + margin Auto 0 + margin Auto
A: I’m… Forget the
conclusion
After about 30 minutes, the interviewer says to stop by and let you know as soon as possible, and that’s it. The above questions are still very basic, some did not answer, or have to continue refueling.
The 4.20 update
Subsequent juejin. Cn/post / 684490…
Gold-digging techniques: juejin.cn/post/1