Luyện nói tiếng Anh bằng Shadowing qua video: Top 15 Frontend Interview Questions for 2026 (wa/ Senior Engineer)

Chọn chế độ luyện tập

Mỗi chế độ mở một phòng luyện tập toàn màn hình.

818 câu
Nếu các câu quá ngắn hoặc quá dài, hãy bấm Edit để chỉnh sửa.
1
The most common interview rejection front -end engineers are getting these days, it's you are not senior enough.
2
That's because answering front -end interview questions in the right way, it's not enough anymore.
3
You have to signal senior level technical depth.
4
In this video, we will go to the 15 most common front -end interview questions
5
and show you exactly how a senior engineer would actually answer them.
6
We will cover topics like front -end fundamentals, front -end system design, and, of course, AI -assisted front -end engineering.
7
Bogdan, let's start with question number one.
8
An AI coding agent built a button
9
that gets bigger on Hoover by changing the button width attribute on the mouse enter event.
10
Any thoughts on this?
11
So, an AI coding agent built a button and gets bigger when we
12
Hoover, So I would imagine it's some sort of JavaScript framework probably, and we have the button,
13
and so it has to become somehow bigger.
14
The easy way to do this without having any performance issues is by using a CSS transformation.
15
Because if we just change the width, what will happen is when we change the width of this,
16
it will trigger what we call a reflow which basically means
17
that the browser has now to recalculate the layout of this section of the page
18
so it has to go through all the buttons look at the css properties
19
and recalculate the width and height and that will trigger the full rendering
20
so it will go through the gpu again generate all the pixels
21
and the smart way to go about this
22
if we want to make it more efficient is to leverage css transitions
23
because css transitions they bypass the reflow
24
and they go straight to what we call the compositor thread this is a different thread
25
and it's specialized in doing easy transformations like scaling something
26
that's a css transformation you can do straight in the gpu usually
27
because it's a mathematical transform and you don't need to modify your layout tree
28
so it was basically designed to handle things like scroll really fast without making the main trend busy
29
and if you avoid reflow you keep the main thread idle you can handle javascript
30
or you can do anything else and have the compositor thread doing the animation
31
if you use css transformation like scale so
32
if we just have to change the button width i would actually clarify it's okay
33
if we also change the button width and the button height
34
and see if we can use a css scale transformation
35
because it's just much more efficient
36
so you always want to bypass the main thread as much as possible right
37
so that means sometimes bypassing javascript itself
38
and going straight to to css exactly you want to bypass rendering to the main thread
39
and the only way to do
40
that is to use as much as you can css transformations
41
because they are built in so they can be done by the compositor thread
42
if as you mentioned you also use javascript to do this change that's even worse
43
because not only you are making the main thread busy with the rendering
44
but you'll also go something to your event loop into your stack
45
so you need to push that into the stack it has to get interpreted
46
and then you modify the DOM which gives a main reflow
47
and that goes through the main thread so you want to avoid
48
that as much as possible
49
and that's by using the compositor thread you can promote this button to a specific layer
50
and then the browser knows that it can handle this differently
51
if it's an easy transformation like an upscale question number two what is your AI workflow
52
for front -end engineering beyond just asking cloud code?
53
Yeah, so I would say that a junior, these days, most junior devs, they just use cloud code.
54
And if you ask them, okay, how do you use AI?
55
They'll be like, I use cloud code.
56
And then some people even mention Copilot or ChatGPT.
57
But if you want quality as a senior engineer from your AI coding, you definitely need a lot more than that.
58
So the way I use AI as a senior engineer right now in the front -end is
59
that number one you work in plan mode first
60
but in your plan mode you want to use any design system
61
that you might have and whenever you plan the feature you also want to make sure
62
that you use some mcp design to code mcp i use figma mcp
63
so basically you want your coding agent like cloud code to
64
do the planning of the feature with your existing blocks with your existing feature so
65
So that's number one.
66
You definitely want your Figma MCB or your design system to be into the features.
67
That's that would be number one.
68
The second part would be I would add some structural constraints.
69
And those are basically mostly around data.
70
And in the front end, we have state.
71
And the main principle to follow here is the single record principle, because what AI usually does is those models,
72
especially cloud code and outputs 4 .8 the reason why the output is
73
so amazing is they over optimize to whatever you asked for they over optimize for the prompt
74
and for the look and feel because that's what makes for amazing demos
75
but what happens usually is that they end up duplicating a lot of code.
76
And I'm not following your design tokens.
77
So if you tell it to do something in a specific color, to hard code the color.
78
And when it comes to state, they tend to duplicate state, which usually becomes a performance problem down the road.
79
And so you want to specifically say, look at the current state architecture, and we're going to apply the single record principle.
80
That means something like a piece of data will be only represented once in our state architecture.
81
And the second thing would be kind of using relative units for css
82
because again these models they tend to hard code things
83
so even if you use tailwind instead of doing like font xs
84
which is a generic tailwind class like an atomic css class it goes ahead
85
and it says like font 11 pixels and it does that
86
because it's again like they really build
87
it to give amazing results from one prompt it's kind of prompt to ui optimization
88
and it comes at the price of code quality.
89
And the third thing would be programming to interfaces.
90
So applying this to the front end, it means you really want to make sure that you're following your risk principles at the data layer level,
91
and then that your components, you should care a lot more about the boundaries around your code.
92
Because AI, once you give it these boundaries, it's pretty good at executing.
93
But you got to look, especially when you're building components, at the kind of props that you see, what is the shape of the state.
94
That's the most important thing that will dictate the quality of everything else around it.
95
One specific problem I remember in the front -end when using AI coding agencies, they tend to not only duplicate code,
96
but also install dependencies you don't really need.
97
So anything you want to mention about tooling?
98
Yeah, so whenever you have a change into either global config or things like your tests,
99
your linter your type checker and your package .json
100
which is in your case the dependencies
101
so basically whenever it adds a dependency that's
102
when you go into manual review you don't need to go to every single component
103
and look at what it did if you had the right guardrails in place
104
but whenever it's touching something like this that's where you look at
105
so whenever you go to your code review
106
and there's usually a lot of files this is where i start
107
because this is where the blast radius of mistake here it's much bigger than
108
if it makes a bit of a mistake or a suboptimal component
109
which usually would be just good enough gets things done
110
and it's okay for the most part gotcha we will talk about front -end testing a bit later on
111
but now that we talk about tests and type checking
112
and all that that brings me to the next question
113
which is how do you keep front -end code quality high
114
when working with ai okay so
115
when it comes to front -end code quality i would go into our traditional front -end code quality
116
which for the sake of clarity we usually split on two categories
117
and this is very important as a senior you always bring clarity to your answers then just go in
118
and be like oh i had a linter or that typescript
119
or that testing you want to really show them how you think in the question
120
so the number one thing i would say is we have kind of two categories right when it comes to code quality.
121
We have static measures, and then we have dynamic.
122
And the difference between these two is that basically static will not run the code.
123
We will try to check the structure of things without executing the actual application.
124
And dynamic, we execute the application.
125
So when it comes to dynamic, it's all about your tests.
126
Usually it's unit tests for the most part, so unit tests, but then you also have end -to -end.
127
Integration, it's a bit tricky because in the front end,
128
it's not very clear whether you put the boundary of a component and if it's a unit test or not.
129
So I'll add it for the sake of completion and integration test.
130
So I'm going to leave those out.
131
But when it comes to static quality,
132
I would definitely add as many static measures as you can because they are deterministic and they are very fast.
133
So whenever you get an LLM to review your code, it's usually pretty slow.
134
It spends a lot of tokens.
135
But static analysis is usually very cheap.
136
And just to give a couple of examples, and I would follow this order, the first thing I would add is definitely use TypeScript.
137
TypeScript was built to work on projects at a big scale,
138
a lot of code, and it's so much easier to add those boundaries and program to interfaces, as we mentioned before.
139
The second thing, I would definitely say I use something like a linter.
140
You could use S -Lint or Oxlint if you want something more performant nowadays.
141
There's definitely better options, but you definitely want the code linter.
142
And finally, there's some new tools that are appearing because of AI.
143
And here we go into static code analysis that goes beyond just linting.
144
And here we would look at the cyclomatic complexity and very important code duplication analysis.
145
So AI, as I mentioned, they tend to optimize locally and you'll usually find the same function in many different places.
146
It's very common for AI to duplicate components.
147
And whenever you do a code application analysis, it tells you how much code, more or less, has exactly the same functionality,
148
how many lines are exactly the same.
149
And cyclomatic complexity is really good at breaking.
150
It's really good whenever you want to break down your logic and functions where there are two nested.
151
And the other thing I'll try to pick up, and you can do this with automated tools.
152
In this case, there's a really good tool that you can use.
153
It's called Fallow.
154
You can find that on NPM.
155
But I would also look linked or file linked.
156
And the most common mistake I see you're doing is you get these huge components.
157
They kind of merge logic and different subcomponents into a single file.
158
And that's when you say, OK, then let's break all this down and start putting a unit test onto all of it.
159
So be really careful because static analysis can pass even
160
if you have very bloated files or very big files
161
but then you go and say okay let's make this unit testable
162
and that's when you need to split things given
163
that ai can now generate hundreds of lines of code
164
and massive pull requests what's your approach to front -end testing you did mention a bit
165
but could you go a bit more in depth sure
166
so i think i mentioned above the three types of testing let's pick
167
that up so as a senior of course
168
if you're talking about interviews you want to mention the three types
169
and be ready to explain them but we want to go a bit deeper
170
because everybody could say yeah just write test but that's very shallow
171
so as a senior you definitely want to look at number one the test coverage
172
so this is usually the measurement of how many lines functions components are covered by test
173
i would definitely aim for anything above 65
174
but don't try to go over 85 because a i will write test for pretty much anything,
175
but it will be this fake coverage where the test, unless you verify the test, you're not sure it really did the right thing.
176
The second thing is I'll try to map out your testing pyramid
177
and figure out where do you stand in the testing pyramid.
178
Because the traditional testing pyramid will look like this, where you have a lot of unit tests at the bottom,
179
some integration tests, and then entry and tests at the top.
180
But what a lot of people do with AI, it's they fall into this fallacy where they say, you know what, a unit test,
181
they don't really matter, integration test, and I'm just going to write end -to -end test,
182
because if I know that my end -to -end test pass on some manual test,
183
like I put my end -to -end test at the top here, then everything will be fine, right?
184
Because the AI can figure out things in between.
185
And what happens there is that whenever you have an error in the front end, you know that your end -to -end test failed,
186
but you don't know exactly in your big code base where that happened.
187
So when you walk with the debugger or with the LLM,
188
you'll either have to spend a lot of time or spend a lot of tokens to find the bug.
189
Whereas if you had unit tests around this, you can easily rule out,
190
you run the unit test and you can easily rule out this part of the code.
191
You're like, this is healthy because the unit tests pass.
192
And then you keep going, you run those tests too, and then you kind of realize, hey, my bug is somewhere here.
193
And it's a lot easier and a lot cheaper to find a bug.
194
Of course, for this, you need a modulized code base.
195
Things have to be relatively clean, But I would definitely have these two mental models in place,
196
test coverage and the testing pyramid and all the different tests.
197
And then to structure your test, you can use the good old A pattern.
198
You tell the AI, hey, I used my A pattern.
199
So basically, they structure your test.
200
No matter what test this is and how complex it is, you can simplify it with the A pattern where you say arrange, act, and assert.
201
So in the first phase, you can arrange remarks and your test doubles, and then you act, you trigger,
202
you render the component, you click the button, and then your search.
203
So no matter how complex your UI is, you can definitely split and simplify your test
204
and tell AI to write them like this because then they'll be a lot easier for you to read.
205
On to question number five, also AI related.
206
How do you keep your token spend low in front -end engineering?
207
So I think this is a very relevant question because right now these models, especially cloud code, they are highly subsidized.
208
So for the most part, if you're on the average subscription, you don't pay per token but we are moving towards paying per token
209
and the most important thing is your front -end architecture taking into account
210
that you'll work with ai and
211
that you need to spend as little tokens as possible for the highest quality
212
so coming back to the idea behind the seller lens usually the way
213
it works is you give an input to the model
214
and then you usually get and output and input tokens
215
if you split your codeways into input
216
and output there's different ways to optimize those but
217
when it comes to input they're usually cheaper
218
so i'm going to put this yellow
219
because this is cheaper
220
this is a lot cheaper than the output tokens the easiest
221
way to spend less tokens is by having less changes in your codeways
222
when you need to implement a feature and the cool thing was
223
that in traditional software engineering we always try to get the feature out with the least amount of changes.
224
And that gets you into your traditional modularization, decoupling.
225
So just to throw some ideas in, you definitely want to keep your changes small.
226
You want a lot of, number one, standardization.
227
So, for example, you're building a new front -end feature.
228
You then need to write CSS, use your Atomic CSS.
229
So there's less changes.
230
And here we go into your design, tokens.
231
We go into your design, system, and reusable components.
232
That's number one and number two would be the architecture side so
233
if you're getting in the front end monolith
234
then i would definitely consider micro front ends now of course you got to look at the performance
235
and so forth but
236
when you have a lot of people contributing to the same code ways
237
it's a lot easier to also control the damage blast radius of a mistake
238
if you split things into independent services like micro front is like services
239
so that's number two i guess your input tokens will drop
240
if you split your monolith into a micro micro front
241
and right where you're only fitting that specific micro front
242
and ideally not the whole code way so exactly
243
and your changes ideally if you're using a design to a concise system are also smaller
244
because you're not going
245
that fast you don't need to replace things across a huge monolith you don't need to take all that in
246
so it's usually easier a lot of people are recommending skills
247
like the caveman skill where the llm will use less words
248
but let's be honest what will probably happen is
249
that they stop charging us per token and they charge you per compute
250
because in the end they want to pass the cost to you
251
so basically it doesn't really matter how many tokens
252
you'll spend what will matter is how much time on the gpu you're using and when
253
that happens you go back into okay
254
i want the least amount of changes to the code base to achieve this feature
255
so we go into decoupling we go into hexagonal architecture are solid principles design patterns
256
and so on so forth question number six what makes a good design system
257
so as i mentioned you definitely need a design system
258
if you want to make things faster with ai
259
and keep some sort of visual cohesion
260
and usually we start with just kind of extracting the design
261
so the number one step would be defining what our design tokens would be
262
and in modern css usually store those as custom properties
263
so basically you kind of go and you you add
264
that your kind of root element and your like brand color
265
and then this is some sort of right now maybe it's like red
266
or whatever so that's how it's going to look like
267
and then all your components are going to use
268
that now you can do this for different teams
269
so you switch those things very easily but that's the first step
270
so a good design system will have design tokens
271
if somebody needs to comes in and says we change the brand color or we change our foreground then
272
And it's a one -line change.
273
Very cheap.
274
The second thing would be building reusable components.
275
You start building your input fields, your buttons.
276
And you can start from scratch.
277
But if you want something accessible and you just want to style it, you could use something like Radix, which is a headless component framework.
278
And basically, you mix that with your own design tokens.
279
And then you have accessible components after the box.
280
Things like drop -downs, they're not so easy to make accessible if you want to style them and so on.
281
It usually takes a lot of work.
282
You don't want to reinvent the wheel.
283
So that's number two.
284
And then number three would be your apply composition patterns.
285
So what do I mean by this?
286
At some point here, you have buttons.
287
You might have a button.
288
You might have an input field.
289
And you take all that and you create a reusable form.
290
As you see, this is a self -service.
291
And your LLM or your other developers, they can go in as, OK, I'm just going to use your design tokens.
292
But then they could be like, OK, I'll just directly use a reusable component or
293
if it really fits their feature just go into a really composed component where you get everything
294
and the last step would be tooling so i added here as
295
that step number four so you definitely want to be using something like storybook render
296
and deploy that so everybody has access they can render the components
297
and interact with them but then you also want to use a design to code mcp
298
so basically your llm can connect to figma and have
299
that as a source of truth and then implement that automatically
300
so you're whenever you implement the feature the coding agents then start improvising
301
and they have something to optimize against which is your design system definition in Figma.
302
Very important concepts because there's been a speculation let's say going around the front -end ecosystem lately
303
which is that front -end engineering it's disappearing and only engineers
304
that can either go full stack like as a front -end engineer you either go full stack right
305
because with ai it's way easier or you're building design systems like
306
that that other engineers can use you definitely need to get a bit deeper into design systems
307
if you want to stay in the front end
308
and for the folks watching us whether you just want to stay a senior front -end engineer
309
or you want to move towards the full stack the best
310
style would be to first find your gaps to senior
311
and for that bug and I built this 10 minutes technical assessment add your email your name
312
and take it it will give you a full overview of
313
what you're lacking for you to make the jump to senior
314
and beyond question number seven could you explain at least at a high level the css box model all right
315
so as a senior developer you want to look at your html
316
and your application and understand that everything in css it's a box
317
so a web page is just a collection of nested boxes.
318
Sometimes they contain each other.
319
So every single element we draw, even if it was a circle, it's actually a box.
320
It's actually a rectangle, let's say that way.
321
And every single element, it's made up of different boxes.
322
So I'm going to start with the outer one.
323
That's our margin box.
324
So this is pretty much the whole element with its margin
325
and outline and then we basically have inside the margin box what we call the border box
326
so that would be the element border and basically your border could be ticker
327
and inside we have the content and between the border
328
and the content we have the padding box
329
so this would be our padding box this would be our content box
330
and this would be our margin box and this is our border
331
and to go even more advanced as a senior dev we know
332
that whenever you apply an element outline it will be rendered between your padding box
333
and your margin so basically just after the border this is
334
when we add an outline or a box shadow all those effects they go here
335
if i were to add like a drop shadow to this element
336
and pardon one thing i wanted to add it's why even bother with this question in this day
337
and age right when everyone is talking about ai and react hooks
338
and we're progressive re -rendering right the reason is it will
339
be very easy for you to solve a box number one
340
if you know the box model right number two
341
you would be amazed by how many developers
342
i know front -end engineers senior engineers 10x experience they cannot explain you the box model right
343
so it's very easy to stand up now you'll get much better at bug fixing
344
and designing layouts which is still the job of front -end engineer
345
and you will stand out in the interview exactly
346
and as i mentioned before the iconic models they tend to hard code things
347
and so the poor way to use the box model would be
348
that you say usually as the f versus specifically out
349
and it'll go like width 300 pixels so to say that
350
and then a lot of people would be confused
351
because then the element occupies a bit more
352
and then we go into your box sizing property like where by default it's content box
353
but you could also say this is border box
354
and this is a very common interview question because a lot of people cannot explain the difference between the default box sizing,
355
which is content box and border box.
356
And basically the difference is that whenever you specify what we call extrinsing width,
357
you are actually specifying what the width will be of either the content or the content width, the padding and border.
358
So when you're into border box and you're saying width 300, this is the width you're specifying.
359
And what the browser will do is to kind of hard code this and try to squeeze your content.
360
If your content takes longer, you'll have overflow.
361
However, the default of the browser, it's extrinsic width.
362
So what the browser does, it says, I'm going to calculate the width of your content, if it's text or whatever,
363
be like, okay, this is your content.
364
And then I'm going to add things around it, if you specify any padding, and I will automatically calculate how much this is.
365
And this is one of those examples where high coding things will make things very hard, because whenever you do this,
366
you're like, oh, no, let's make this width 300, which ai models do very often you completely break responsive design
367
and you make it a lot harder to achieve a good layout in different screens
368
so it's going to look very good your ai coding agents will be like okay
369
i'm done with the feature you look at it it looks very good you deploy it looks awful on mobile
370
and then you need to make a hundred hacks to make
371
it look good on mobile what they usually do is they add breaking points
372
and they specify another width for all those break points but
373
if you follow the standards that browser engineers built into the browser.
374
You just solve all this with a line of code instead of a lot of CSS.
375
And that's where engineers who are not that senior, I would say, they get a lot of productivity increase by AI in the first iteration.
376
They get 80 % done and then the 20 % gets stuck in this kind of box.
377
And then they realize, oh, it took me longer to build it with AI than actually doing it myself.
378
And I haven't learned too much.
379
I haven't learned much by actually doing it with AI, right?
380
Exactly.
381
And the one thing I want to mention here, and we're not going to dive there,
382
but make sure you check margin collapsing because that's an exception
383
that was built into the box model to make things look
384
good in the early times of the web where we're going to impact us
385
and that's also very common interview question for very advanced
386
front -end engineers on to question number eight also about css how does css specificity work
387
and back then i know there is a lot of detail to answering this question properly,
388
just let us know what would a senior frontend engineer cover.
389
To understand CSS specificity, we need to really in -depth understand how CSS works at the fundamental level.
390
And at the fundamental level, any CSS declaration will have a selector, right?
391
So let's imagine we have an ID selector.
392
And so we're going to look for, let's just say we use form, right?
393
This is a very generic selector that will target all our forms.
394
But then I can get more specific I'm going to say, okay, let's target a form that has the class big form, let's say.
395
And then I can add my CSS property and be like, okay, color, or I'm just going to say background color white.
396
Now let's imagine somewhere else in the code base.
397
Let's imagine this.
398
I'm somewhere else in the code base and I'm targeting a form with an ID my form.
399
Finally, my HTML markdown looks like this.
400
I have my form, it has an ID that it's my form, and it's as a class, big form, the class at here.
401
And so the question is right now, which one of the styles would be applied?
402
Let me change this to blue.
403
Are we going to have background blue or background white for our form?
404
And what CSS selector specificity does is that when the browser collects, so basically the browser would collect all these goals and be like,
405
Like, okay, this selector and this other selector, they're both pointing to this element.
406
And I'm trying to figure out the final styles of this element.
407
It will apply the cascade algorithm.
408
And this cascade algorithm, it's quite complex.
409
I'm not going to go in depth.
410
But there is this one step where you figure out which selector has higher specificity if they're in the same layer, like in this case.
411
So it will basically look at this and give a specific score to each one of those.
412
And the way that works is that we basically have a three -tier specificity, A, B, and C.
413
And so A will increment from zero.
414
They all start at zero, right?
415
So we start with zero, zero, zero, and we try then to score each selector.
416
And so the first selector, this would be whenever you use an ID, then you increase A.
417
Whenever you use an attribute, like a class attribute, it's going to be B that you increase.
418
And finally, C would be for the element type.
419
So let's score really quickly our both selectors.
420
So for the first one, form is definitely a type of element.
421
So C would be one, right?
422
And then big form, it's a class attribute.
423
So that would be one.
424
And the first one would be zero because we don't reference any ID.
425
And for the second one, I have an ID.
426
So that's the only thing that matters, right?
427
It's a one.
428
And then the other ones are zero.
429
Now, specificity, it's a tire based.
430
It's tire based.
431
So whoever wins is the one that has the left, right, higher
432
and if there's a draw then we go to the right hand
433
so right now this one it's a winner
434
so it will basically apply the background color blue
435
and the reason for that is
436
because it's like levels right it's not like a sum
437
or anything like that it's just like they will check the first number
438
if that number it's okay they'll check these ones right
439
but we don't even get there
440
because this one has a one this one has a zero
441
so we end up selecting this one
442
and basically what the browser will do it's in the computed styles of this element
443
which you can check in the crumb dev tools you'll see
444
that the background color was finally blue and
445
if you go into the the tools you'll see this one probably under
446
and it's strike you'll see background color white crossed and
447
if you hover on top you'll see the specificity of
448
that question number nine what are the core principles of responsive design
449
and it's a very good question
450
because whenever you build with ai
451
you want to have those things at the very beginning of the early phases of the design
452
so your ai code it's already responsive and
453
if you don't trust me it will generate something
454
that looks really good on your machine
455
and then somebody cannot open it on mobile
456
but the core principle is basically you want to make things as adaptive as you can and
457
if you look at the three core pillars of this it would be number one
458
you want to have relative sizing units
459
so you never want to use pixels for example you don't want to use
460
that you only use pixels you want to instead use things like percentages, RAM, the root font size,
461
or M, whatever it applies.
462
So the difference between these two is that this one points to the root element,
463
to the HTML element, and this one is relative to the parent.
464
So whenever you're building usable components, you're going to use M, but whenever you want to look good in the scope of your application,
465
then you're better off using the RIM, the relative sizing unit.
466
Now that's number one.
467
Number two would be using the appropriate layout algorithm.
468
And for the most part, I'm going to generalize here saying that flex is probably the easiest thing for responsive.
469
Whenever you use block, it's also really good for very simple layouts.
470
Block and flex are pretty good.
471
Block is the default of the browser.
472
So things will just display basically like in a book.
473
Biographs display under each other and words display in line.
474
And And then flex allows you to have more freedom.
475
If you go into grid.
476
If you have a very complex layout and you need to use grid, it'll only work well if you're very proficient at using the grid,
477
which is kind of hard, or you use a lot of media queries.
478
And this is my kind of third pillar, which is adding breakpoints, right?
479
So it'll be breakpoints and media queries.
480
If you want the cheap way to go about this, just use the ones that tailoring has.
481
For example, there's a lot of those big frameworks.
482
They've done a lot of testing and they have the right breakpoints
483
so i wouldn't reinvent the wheel here you can either borrow the tailwind one directly by using tailwind
484
or tell your coding agent to implement the tailwind breakpoints globally
485
question number 10 can you give me a high level overview of the event loop sure
486
so basically the event loop was built
487
because javascript is single threaded the reason why javascript is single threaded is
488
because it was easier to predict how the dom will look like
489
if you keep javascript single threaded the browser it's for the most part multi -threaded
490
so it'll be very easy for browser engineers to also make javascript multi -threaded
491
but it'll be very dangerous it'll be harder to render
492
and you'll have all those crazy bugs that come from parallelization
493
and especially because whenever we change something in javascript we change the DOM
494
which is this unique single tone kind of structure javascript it's single threaded
495
and so we usually have our stack which is the one
496
that will execute things so whenever you execute something you want to execute a function you push
497
that into your stack frame it goes into here and
498
that will try to execute it has the closures it has all the variables
499
that i to execute
500
but many times we don't necessarily need to do something in me well we want to do things asynchronously
501
so we also have two queues that help the stack and
502
so basically we have a micro task queue
503
and a micro a macro task that will be a micro task
504
and we have our micro task okay
505
so whenever a promise will resolve it doesn't get pushed to the stack it for example the dot then of
506
that promise gets pushed into the micro task now whenever you have a browser event
507
that calls an event handler or a timer function the event callback would be here right
508
so whenever you have this on click right you have on
509
and then you have your click then the click handler will be run by the micro task micro task
510
and so the difference between these two is
511
that you can think of the event loop
512
so this would be the loop here
513
and by the way the loop is implemented in the web browser
514
but all these things that i showed they leave in the v8 engine
515
so i'm going to send that to the back
516
so this is the v8 engine
517
but then the loop then the loop it's implemented in c++
518
and so basically what the loop does is
519
that it looks at the main thread and
520
if the main thread it's it all then we can run javascript
521
and then it looks at the stack
522
and tries to execute everything in the stack
523
and then we finally check is there anything in the micro task
524
if there's something in the micro task we push it to the stack to the bottom of the stack
525
so it gets pushed here gets executed and then we're done
526
and we don't immediately pick the micro task we stop
527
and we see is there anything in the main thread
528
that needs rendering so then the main thread we do any render work we push
529
that to the cpu and then we execute that and
530
when there's no more rendering work then the loop goes again
531
and looks at the micro task
532
and be like okay then push this micro task to the stack
533
so it basically allows you to do intermediate javascript running
534
so in a way
535
you have this you can think of it as a two as a conveyor belt to the same robot
536
so this is our cpu and what they try to do is to basically chunk things
537
so you get a bit of javascript that you interpret
538
and then you stop and you do some rendering work
539
because maybe they change the DOM
540
and into re -render you don't want to freeze the UI
541
and then there's a bit more javascript to do
542
and then maybe you you do some rendering work again there's two parallel conveyor belts
543
that push work to the cpu and that's why we say
544
that javascript it's it's blocking right so you don't want to block the main thread and when When you say mentrad,
545
that means rendering whatever in the browser, right?
546
So there's always a balance between rendering work to the CPU and actually, let's say, processing, like loop, event loop work to the CPU, right?
547
To a CPU.
548
Exactly.
549
So these two things, they share the same space.
550
So you can either do one or the other.
551
And this is done on purpose.
552
They could have split it, but they said you're either going to render or run JavaScript to keep DOM integrity integrity.
553
You cannot run JavaScript to modify the DOM while we render.
554
That would break the UI state.
555
It's a bit too complex to program with that model.
556
I see you leaked the question number 11, but before we move on to question number 11, I wanted to ask you beyond,
557
let's say, the theoretical understanding of the event loop.
558
Did you ever have any production bug related to the event loop?
559
So the most common production bugs I saw so is
560
because this part that we push the stack is too expensive
561
and this is usually related to component frameworks
562
so imagine you have a form field
563
and the user is typing sometimes people add too many handlers there like event handlers
564
and those they get pushed to the event stack
565
and there's too many renderings going on and then the user they type
566
and it kind of looks like it's lagging
567
that's very common in slow applications usually what you want to
568
do is to leverage as much as you can memorization
569
you got to look at your stack as very good at doing intermittent work
570
so you want to send to it very small units of separate work
571
and then it's going to work just fine it was designed to work like
572
that you don't want to send any big chunk of work
573
so you want to make your renderings as efficient as possible
574
you want to use memorization especially in this big component frameworks question number 11 supposing
575
you are handed a react code base
576
that has been vibe coded the product manager complained
577
that the application is slow how would you deal with this
578
so i would really try to first clarify is it loading speed
579
or is it reactiveness to input like we just discussed to user input
580
but usually when they complain about it being slow it's loading speed
581
so in that case i would say if it's a code code base it was vibe coded, then probably I would check the bundle size.
582
And then I would check our memorization layer.
583
So basically, if you're using the React compiler, then it's easier, but you want to use as much as you can.
584
I use memo, use callback, and memo itself to make re -renders fast to avoid re -renders.
585
But not only that, I would check if is there any SSR going on
586
and if using server components because you really want to ship as little javascript
587
or defer your javascript to make things load fast
588
so the biggest the reason why things load very slow usually is
589
because you ship a lot of javascript and
590
if you go through the critical rendering path
591
you have these big assets these big css this big javascript they need to be parsed interpreted
592
and then you move on with the actual rendering
593
so i'm not i don't want to go too in depth into the critical we have videos on the channel
594
that explain it in depth
595
but for the most part you want to ship as little jobs as possible
596
and use dynamic imports to delay the rest do like code splitting
597
and you can do code splitting based on the path
598
or user actions and so on
599
but the first thing i'll check is get the module bundler analyzer
600
and check your bundler size see if you can eliminate any libraries
601
that are being loaded or defer them load them
602
when they are being used and then use server components to load even less JavaScript.
603
And when it comes to reactivity user input, it's all about re -renders.
604
And when it comes to re -renders, you can either do two things.
605
You either make them faster or you avoid them.
606
So if we want to avoid re -renders, you could use, I already mentioned that one, it's react .memo.
607
So it would basically compare your props and make sure
608
that you don't unnecessarily re -render a component just because the parent re -rendered,
609
you don't go ahead and render something if it receives the same props
610
and the other one would be okay let's say
611
we do have to re -render then we want to use callback
612
and use memo so we make sure that all the variables
613
or functions declared in component are not being computed
614
but the other thing they don't tell you it's also try to make your component lean
615
that means any logic that doesn't really need state
616
or directly need state could be taken out of the component as an independent function
617
It will only get created once when you load the application, and then it doesn't get created again and again when you re -render.
618
So that will be the third pillar.
619
The final thing I would say is you got to take care of your state.
620
If you lift state up unnecessarily,
621
whenever that state changes, it will automatically see a re -render of the components if it's very up in a component tree.
622
So using your state and keeping it as close to where it's being used, make sure that you don't have a necessary re -render still.
623
Question number 12, and back to JavaScript fundamentals now, what is the difference between object and map?
624
So there's a couple of differences between map and object.
625
Probably the biggest one is that object, you can only use as keys either strings or symbol,
626
where in the case of a map key, it can be pretty much anything.
627
And this is because maps are pretty good at building those memorization objects.
628
If you need a memory and you want to store things with a unique key,
629
then you can pretty much use anything and put it in there.
630
There's many other differences.
631
Like, for example, you could iterate over an object, but you need to use this object entries or keys.
632
Whereas with map, it directly contains an iterator.
633
But the problem with map
634
and the reason why we don't use it as much in production is
635
that the syntax is just not as popular and comfortable as an object.
636
So for the most part, people are using objects, but whenever you're building a storage of something
637
that you need to go way beyond just using for your key strings or symbols,
638
then probably taking into account you can use a map for that.
639
On to question 13,
640
can you explain the difference between map and wikmap and touch upon memory management and garbage collection in JavaScript?
641
The biggest difference when it comes to memory management is that map cannot be garbage collected.
642
So if you have a map and there is a key inside it, let's say inside your map,
643
you have a key pointing to something that was garbage collected or it's not needed anymore,
644
it will not garbage collected so if you keep adding things to your map
645
and you don't garbage collect then you'll end up with a memory leak now just
646
because the garbage collection algorithms of javascript is not capable of going into the map
647
because of how it's built and if a key is not used anymore drop that
648
basically by not being used anymore in the terms of memory management
649
and garbage collection we mean that is not reachable from the bottom of the program
650
so whenever you have your javascript environment you have your dom
651
and then you have your object they have to be somehow either attached to the dom
652
or to an event handler so they are not garbage collected
653
if you have something that's not attached the garbage collector item will go to it
654
and swipe and then mark this as okay you can reuse you can reallocate
655
that memory so basically what happens with the map is
656
that you cannot really go inside that map and you keep things
657
and you can easily go into a memory leak with a weak map okay whenever you have a key
658
that was garbage that can be garbage collected it can it will be removed
659
so have a key and it's not referenced
660
or it's not reachable as we say from the top then the garbage collection algorithm will go in
661
and be like okay you're done take it out
662
but keep your week map in memory
663
and that's the cool thing about it now the problem with
664
the week map is it doesn't implement the iterator property
665
so you cannot go into a week map and do a for each
666
or go to each one of those keys
667
and do something you really need to store the key
668
that you were accessing into the week map
669
so from a programmatic point of view they are highly to use
670
but they are excellent
671
when it comes to building memories for your function imagine you have a function
672
and you want to memorize it you're better off using a week map
673
it's going to be a lot easier for you in terms of memory
674
and a lot safer than a pure map question number 14 suppose
675
we had to scale a front -end application from a thousand
676
daily users to a hundred thousand daily users how would you
677
go about it at least at the high level okay
678
so i'm gonna focus on the front -end only right
679
because definitely going from a thousand to a hundred thousand
680
there's a lot of background work there yeah front -end zero now perfect
681
so let's look at the front -end only
682
i'll say probably the easiest thing to do at the front -end application like imagine
683
i have my front application is it server render
684
or the client render let's do both
685
but let's start with the client render thing and then talk about how things would change in the case of SSR.
686
Okay, if it's clang, it's going to be pretty easy because you just have static assets, JavaScript HTML and CSS.
687
And I'm just going to push
688
that to like a CDN network that's going to distribute that across the world with the right caching policy.
689
We have this network and then people access that from the one closest to them.
690
The only problem is I would kind of do a lot of not only bundle splitting.
691
So what you want to do is to have a selective caching policy, Which means in your founder application,
692
you have things that don't change that often, like your design system or your car logic or your stable vendors.
693
What do we mean by that?
694
Things like your React package and React.
695
You are unlikely to change that every year.
696
So what you want to do is to have your users not re -downloading
697
this part of the bundle every time they go in.
698
So at Webpack or Vite level, you define your chunks.
699
And you could say, for my application, which is this big bundle, I want you to split it into a very stable, long -lived bundle.
700
So let's say
701
React DOM, they go into here.
702
That's one file.
703
And then I have my logic and components in this other smaller file.
704
So what happens is when you hit the max age, which is basically how often should a client refresh that resource,
705
you can have a much more aggressive max age on your stable vendors.
706
You can be like, only check if this changes every seven days, let's say whereas for your components
707
because you are deploying very often you want them to get your latest bundle your latest javascript
708
and then you put like a five minutes max age on
709
that one so again the reason why i'm saying this is
710
because every kind of junior
711
and middle -level front -end engineer would be like use a cdn
712
but there's different ways to use a cdn
713
and you see how the way you build your application
714
and you split your bundle
715
and your build process influences how you can actually selectively cache those things
716
so that would be number one
717
and then in terms of different optimizations i'll probably try to keep things lean
718
and the lucky part with the front end is that
719
if you're only doing client -side rendering it's pretty easy to scale given
720
that we have a design system i would only think about micro front ends
721
if you have a lot of developers working on same application
722
so then it makes sense to to split this to have better failure modes
723
and less blast radios if somebody messes something up
724
but i think you can handle 100 ,000 daily users with a single monolith for an application too gotcha
725
and about ssr what would you how would
726
that change the picture yeah the problem with ssr is
727
that it's fairly complex because all of a sudden everybody
728
that gets your static assets they start making requests back to your server to basically render the server
729
so everybody goes back and that creates a scaling bottleneck right here there's also latency right
730
because all of a sudden the user goes here gets their static assets
731
it's really fast let's imagine the user was placed they get the static assets
732
but then yeah they still need to go to your server
733
so now you have latency too the modern way to do this would be maybe
734
if you use something like an edge system where you kind
735
of have cloud fair workers for example distributed over the globe
736
and they are like a distributed back end
737
so you do server side again they're close to the user
738
but then guess what you distributed your workers now you also have to have an edge database
739
so you need to put your database closer to the user
740
and the way you usually do this in a consistent way is
741
that you have in a fairly perfect world
742
and you would have your static assets
743
so this is your front end close to the user distributed
744
then you also have your back end as a worker let's say
745
you put this in like a cloud fair edge
746
or a versell kind of alternative
747
and then you also have your read -only database replica
748
which you could do with different services like prisma and
749
so on the effort is distributed databases
750
and this is kind of your whole edge location
751
so all of a sudden your cdn
752
which is independent replicas of your of your application
753
now you still have a kind of master version right that's the one you're deploying is this one
754
and whenever they need to write then then this kind of application still needs to go and write to your main DB.
755
So writes will be expensive, and you'll have only eventual consistency because whenever you write in the database,
756
it needs to propagate to the read -only instances.
757
So you maybe get eventual consistency.
758
According to CAPT theorem, you'll have a bit of an inconsistent state, but for the most part, you'll be able to scale.
759
Now, again, this is a very hypothetical kind of setup most of the times
760
it doesn't make sense for you to invest in this unless you really have distributed traffic
761
and performance is super critical
762
because this kind of systems they are very complex there's a lot of caching validation
763
that you need to do and if something goes wrong it's extremely hard to debug
764
and final question for today bogdan question number 15
765
if we were to integrate an llm powered chatbot into our
766
front -end application what kind of real -time communication protocol would you use for
767
that implementation and why also if you could go to the pros
768
and cons at least at the high level okay sure
769
so for the most part
770
you have like the easiest way to add some real time kind of real time is to use polling
771
you basically you just call your backend every five seconds
772
and you can use timer functions for
773
that we talked about the event loop you could use like set interval
774
and every five seconds to a fetch and see
775
if you get like new data and put
776
that in your state the problem there is
777
that you are ddos in your back end so
778
if you have 10 000 clients like in the previous step you're spoiling you got to multiply
779
that you have all those requests hitting your back
780
and you're gonna bring your back end down
781
so it's not really it doesn't scale very well
782
but it's very robust it's very easy to deliver the other one
783
it's web sockets also takes a bit more work on the back end you open this communication channel
784
so each client opens a bidirectional communication channel.
785
And this is very good for whenever you have a chat application because these bidirectional channels, they send updates back and forth.
786
So if the user sends a message to the backend, then the other user immediately sees it.
787
That's how you have these peer -to -peer applications.
788
That's how they work.
789
But again, it doesn't scale very well.
790
It's very intense, compute intense on the backend.
791
It's also a bit more complex.
792
And we're talking about LLM.
793
So the thing with LLMs is that the communication is very asymmetric.
794
So you have your client and then we have our model.
795
Let's say this is our model.
796
And so usually what happens is the client will send a query and then the model will answer with different chunks, right?
797
It will answer with your first token, second token, third token, final token, computer sentence.
798
So it's very asymmetric and that's why you could use service and events. So SSCs.
799
So basically we have our service and events here.
800
You make one post request with your conversation and then you listen on
801
that endpoint and you get all the chunks as the model generates
802
that and it's probably the most robust way it's a native api in the browser
803
so there's no need for anything fancy you don't even need a library
804
you can really use this with vanilla jas i use
805
this with the open ai package they have it under the hood most chat applications will use
806
that and so with open ai you just have an iterator
807
that you get and you can as a developer i kind of get your tokens from it
808
but under the hood they use service and events
809
if you go to the network tab in chat gpt
810
or cloud and you look at it you'll see the tokens coming through in the event stream tab for that request
811
Awesome, Bogdan.
812
I feel like this has been a hell of a video, so we're going to stop here.
813
But what I would say, folks, is if there is any question you've got in senior front -end interviews
814
or front -end interviews that you want us to answer in one of these series, then drop it in the comments below.
815
Also, if you're interested in getting to a senior developer and being able to go to interviews like Bogdan does,
816
then check out the link for the free training to see how you can do
817
that in the most effective way and also how Bogdan and I can help you to our premium mentorship program, help you get there faster.
818
With that being said, Bogdan, thank you.

Tải Ứng Dụng

Mọi thứ bạn cần để nói trôi chảy

Chấm điểm AIChấm từng câu nói
Luyện IPAThành thạo mọi âm
Từ vựngMở rộng vốn từ
Game Từ vựngHọc qua chơi

Cùng kênh

Từ vựng và ghi chú luyện nói cho bài học này

Bài luyện nói này dựa trên video “Top 15 Frontend Interview Questions for 2026”. Video này có 818 câu và 9974 từ để luyện shadowing. Phần lời nói dài 50:40. Người nói nói nhanh, khoảng 197 từ mỗi phút, nên sẽ có nhiều chỗ nối âm và nuốt âm. 84% số từ nằm trong 3.000 từ tiếng Anh thông dụng nhất; phần còn lại nên xem trước khi luyện.

Từ vựng quan trọng trong video

15 từ đáng học trong video, kèm phiên âm và nghĩa:

TừPhiên âmNghĩa
component danh từ/kəmˈpoʊ.nənt/bộ phận
thread danh từ/ˈθɹɛd/chỉ
stack danh từ/stæk/chồng
width danh từ/ˈwɪtθ/chiều rộng
element danh từ/ˈɛləmənt/yếu tố
loop danh từ/luːp/đường nhánh, thòng lọng
garbage danh từ/ˈɡɑɹ.bɪd͡ʒ/rác
cloud danh từ/ˈklaʊ̯d/mây
server danh từ/ˈsɝvɚ/trình chủ, máy chủ
principle danh từ/ˈpɹɪn.sɪ.pəl/nguyên lí, nguyên tắc
implement động từ/ˈɪmpləmənt/thực hiện, chấp hành
bundle danh từ/ˈbʌn.dl̩/chùm, bó
developer danh từ/dɪˈvɛləpɚ/nhà phát triển
architecture danh từ/ˈɑː.kɪˌtɛk.t͡ʃə/kiến trúc
pixel danh từ/ˈpɪk.səl/điểm ảnh

Cụm động từ bạn sẽ nghe

TừNghĩa
break down động từhỏng, hỏng hóc
check out động từtính tiền, trả phòng
go back động từtrở lại
pick up động từnhặt, lượm
stand up động từđứng dậy

Những câu đáng luyện lại

Các câu ngắn, trọn ý trong video mà bạn có thể dùng lại khi giao tiếp hằng ngày:

  • Bogdan, let's start with question number one.
  • They'll be like, I use cloud code.
  • How do you keep your token spend low in front -end engineering?
  • You don't want to reinvent the wheel.
  • What do we mean by that?

Ngữ pháp trong video

Những cấu trúc người nói dùng nhiều nhất, kèm đúng cụm từ trong video:

Cấu trúcTrong video
Câu điều kiện if + mệnh đề, will/would + động từ — điều kiện và kết quảIf your content takes longer, you'll have · if that number it's okay they'll check · if you hover on top you'll see
Câu bị động be + quá khứ phân từ — nhấn vào việc xảy ra, không phải người làmwas basically designed · are built · will be only represented
Mệnh đề quan hệ who / which + mệnh đề — thêm thông tin về người hoặc vậtRadix, which is · against which is · layouts which is
Thì hiện tại hoàn thành have/has + quá khứ phân từ — việc đã xảy ra nhưng còn liên quan đến hiện tạithere's been · haven't learned · They've done

Phát âm cần chú ý

Người nói dùng 144 dạng rút gọn, ví dụ you're, don't, I'm. Hãy nói theo dạng ngắn đúng như bạn nghe.

  • Âm “th”: thread /ˈθɹɛd/, width /ˈwɪtθ/, algorithm /ˈælɡəɹɪðm̩/, monolith /ˈmɑn.əˌlɪθ/
  • Âm “sh” và “zh”: transformation /ˌtɹæns.fɔɹˈmeɪ.ʃən/, integration /ˌɪn.tɪˈɡɹeɪ.ʃən/, efficient /ɪˈfɪʃənt/, cache /kæʃ/, transition /tɹænˈzɪʃ.ən/
  • Từ dài — đặt trọng âm cho đúng: transformation /ˌtɹæns.fɔɹˈmeɪ.ʃən/, developer /dɪˈvɛləpɚ/, architecture /ˈɑː.kɪˌtɛk.t͡ʃə/, fundamental /ˌfʌn.dəˈmɛn.təl/, integration /ˌɪn.tɪˈɡɹeɪ.ʃən/

Những âm người Việt thường gặp khó:

  • Cụm phụ âm cuối — đọc đủ từng âm, đừng nuốt âm cuối: component /kəmˈpoʊ.nənt/, width /ˈwɪtθ/, element /ˈɛləmənt/, implement /ˈɪmpləmənt/, react /ɹiːˈækt/
  • Âm /tʃ/, /dʒ/ và /ʒ/ — tiếng Việt không có, đừng đọc thành “ch” hay “gi”: garbage /ˈɡɑɹ.bɪd͡ʒ/, margin /ˈmɑɹ.d͡ʒɪn/, architecture /ˈɑː.kɪˌtɛk.t͡ʃə/, chunk /t͡ʃʌŋk/, package /ˈpæk.ɪd͡ʒ/
  • Âm /æ/ — mở miệng rộng hơn âm “e”: stack /stæk/, static /ˈstæt.ɪk/, transformation /ˌtɹæns.fɔɹˈmeɪ.ʃən/, react /ɹiːˈækt/, pad /pæd/

Cách luyện với video này

  1. Nghe hết video một lần, chưa cần nói, và ghi lại những từ bạn chưa biết.
  2. Bắt đầu ở tốc độ 0,75×, nói đuổi từng câu, rồi quay lại tốc độ bình thường khi đã quen.
  3. Ghi âm giọng mình rồi so với bản gốc, chú ý các từ như component, thread, stack.

Phương Pháp Shadowing Là Gì?

Shadowing là kỹ thuật học ngôn ngữ có cơ sở khoa học, ban đầu được phát triển cho chương trình đào tạo phiên dịch viên chuyên nghiệp và được phổ biến rộng rãi bởi nhà đa ngôn ngữ học Dr. Alexander Arguelles. Nguyên lý cốt lõi đơn giản nhưng cực kỳ hiệu quả: bạn nghe tiếng Anh của người bản xứ và lặp lại to ngay lập tức — như một "cái bóng" (shadow) đuổi theo người nói với độ trễ chỉ 1–2 giây. Khác với luyện ngữ pháp hay học từ vựng bị động, Shadowing buộc não bộ và cơ miệng phải đồng thời xử lý và tái tạo ngôn ngữ thực tế. Các nghiên cứu khoa học xác nhận phương pháp này cải thiện đáng kể phát âm, ngữ điệu, nhịp điệu, nối âm, kỹ năng nghe và độ lưu loát khi nói — đặc biệt hiệu quả cho người luyện IELTS Speaking và muốn giao tiếp tiếng Anh tự nhiên như người bản ngữ.

Phương pháp shadowing: đọc hướng dẫn từng bước đầy đủ →