Tencent internship | front end
-
A quick introduction to yourself?
-
The way of learning?
- Modern JavaScript Tutorial
- MDN
- Ruan Yifeng ES6 tutorial
- Various official documents
- Visit tech Community
- I’m not a big fan of video learning
-
What technology are you most familiar with?
- Here I mentioned JS, CSS and H5
- Basically just say what comes to mind, you know
- The interviewer took the initiative and listened to me without interrupting
-
Tell me about
CDN
The principle of- Only said the function of CDN, the principle can not answer;
Here are the answers from the Internet:
Assume that your accelerated domain name is www.a.com. After you access the CDN network and start to use the accelerated service, when the end user (Beijing) initiates an HTTP request, the processing flow is as shown in the following figure.
- When the end user (Beijing) to
www.a.com
The LDNS initiates a domain name resolution request to the local DNS. - LDNS checks if there are any in the cache
www.a.com
IP address record of the. If yes, it is returned directly to the end user. If no, consult the authorized DNS. - When authorized DNS is resolved
www.a.com
Returns the domain name CNAMEwww.a.tbcdn.com
Corresponding IP address. - The domain name resolution request is sent to Aliyun
DNS
Schedules the system and assigns the best nodes for requestsIP
Address. LDNS
To obtainDNS
Parsing of returnsIP
Address.- User acquisition resolution
IP
Address. - Obtained from the user
IP
Address initiates an access request to the resource.- If the
IP
If the node corresponding to the address has cached the resource, the data will be directly returned to the user, for example, in steps 7 and 8 in the figure. The request ends. - If the
IP
If the node corresponding to the address does not cache the resource, the node sends a request for the resource to the source site. After obtaining the resources, cache the resources to the node (for example, the Beijing node in the figure) based on the user-defined cache policy and return the resources to the user. The request ends. For details about how to configure a cache policy, seeCache configuration.
- If the
-
Talk about common ones
ES6
New features?-
Const, let
-
The map, the set
-
Promise, async, await
-
Expansion operator…
-
Deconstruction assignment
-
Default values for function arguments
-
The iterator, for… of
-
Class
-
Symbol
-
Extension of functions and arrays
-
-
New method compatibility?
IE 10/11 above? (Smart guy, ES6 is completely dead in IE, Edge 14/15 compatibility is over 90%)
-
How do I know if these methods are compatible?
- MDN
- Can I Use
- Go straight to the Internet
-
.
和Array.from
What’s the difference between a transform array?.
Can only be used foriterableArray.from
Not only can be used foriterableCan also be used inArray like object
-
Talk about direct useobjectSave the sum of key-value pairs
map
What’s the difference between a key-value pair?My head was suddenly confused. I hadn’t looked at map for a long time and couldn’t answer
Object
There are prototypes (unless actively set upObject.create(null)
), there are some defaultskey
It’s on the prototype chain, butmap
There is no- in
Object
Object, can only putString
和Symbol
As akey
Value, but inmap
,key
Values can be of any type - through
Map
In thesize
Property, which can be easily obtainedMap
Length; Object has no direct length method
-
The cache
-
Why Etag
- Some files may change periodically, but their contents do not change (only the modification time), at which point we do not want the client to think that the file has been modified and redo
GET
; - Some files are modified very frequently, such as in seconds or less,
If-Modified-Since
The granularity that can be examined is S - Some servers do not know exactly when a file was last modified.
- Some files may change periodically, but their contents do not change (only the modification time), at which point we do not want the client to think that the file has been modified and redo
-
If you could choose only one cache, what would it be? Why is that?
- Negotiation cache, if strong cache is selected, local data will never get the latest network data
-
How do you reduce requests by selecting only the negotiated cache?
A: Use localStorage and sessionStorage to help cache local data, and negotiate cache the data that is not available locally
Follow-up: But localStorage and sessionStorage are mostly [character level] content, and network request data is mostly [file level] content
A:… The whole won’t
-
-
Intelligence problem: now is the afternoon 5:35 minutes, seek pointer included Angle?
Here is very embarrassing, the subtraction is written as plus points, the interviewer asked me for my idea, I thought about it and found that it was written backwards/laughing and crying
-
How do you use it anyway
CSS
Hide an element?- display : none
- visibility : hidden
- opacity : 0
-
Can you think of anything else besides the usual three?
- After position moves off the screen, set Overflow: Hidden to prevent the user’s scroll wheel from finding the element
- The Z-index setting is shaded with other elements at the bottom and top of the screen
- If the element is empty, you can set the background color to Transparent
I was so nervous about the interview that I couldn’t think of any other way.
- 2D graphics can be rotated by 90° with rotate
- All data is set to 0 and all borders and outside lines are removed and overflow: hidden
-
Shake hands and wave?
I’m just starting to say it before I say it again
-
AJAX?
Balabala omit
-
Other front-end optimizations?
- Combine requests to reduce the number of requests
- Sprite, font ICONS, SVG, Webp
- The cache
- Compress resource size
- CDN
- DNS
- Resource loading time
- Reduce reflux redraw
- webpack
- Throttling stabilization
-
You just mentioned
Webp
May I sayWebp
Compatibility?- Webp has a better image compression algorithm
- As far as I know, Webp works well on Android phones
-
webp
The principle of image format (why better compression)?silence
-
What about compatibility on PC browsers?
- Probably compatible with Chrome as well
- It feels like overall compatibility should be poor
- I don’t know much about WebP compatibility in browsers
-
Sprite, font ICONS, SVG ICONS reduce load load?
Balabala omit
-
How to make the patting method in your project compatible with IE?
- The first thought is to determine compatibility and build your own wheels (stupid)
- The interviewer reminds you to polyfill.
-
What CSS goes on top and JS goes on bottom?
- Introduce script async and defer
-
HTTP status code?
-
Please complete a tool method to count the words that appear most frequently in pure English articles. Input is the content of the article, output is the words that appear most frequently and the number of times
-
When can I start my internship?
-
The internship time
-
Senior year without classes?
ask
-
What department am I interviewing for?
CSIG Tencent Education
-
What are the main technology stacks in the group? (MY major is Vue)
Popular frameworks will be used, but React is mainly used in consideration of uniformity and convenient management. React is more preferred, but other frameworks also exist (public ownership as the main body, and multiple ownership common…).
-
Group atmosphere?
-
Is it teamwork or personal development?
Teamwork… (chat)
Half past six in the evening, the end of the interview, each rush to dinner