VHow do you keep a large frontend codebase from slowing down?
Senso della risposta✓
Lingua2
Domanda dell’intervistatoreFrontend
Chi intervista per i ruoli frontend parte spesso dalla piattaforma: come il browser renderizza una pagina, come JavaScript gestisce le attese e come il CSS costruisce un layout. I framework cambiano ogni pochi anni, ma queste idee restano le stesse. Se sai spiegarle in un inglese semplice, puoi lavorare con qualsiasi framework.
Mantieni le risposte pratiche. Di' che cosa misureresti, che cosa controlleresti negli strumenti del browser e che cosa vedrebbe l'utente. A chi intervista piacciono i candidati che collegano i dettagli tecnici all'esperienza di una persona reale che usa la pagina.
- ✓Parole → espressioni → frasi → parlato
- ✓Senso della risposta
- ✓Lingua
Domande comuni e risposte di esempio
How does the browser turn HTML and CSS into a visible page?
Come fa il browser a trasformare HTML e CSS in una pagina visibile?
Che cosa vuole sentire l'intervistatore. I passaggi (DOM, stili, layout, paint, compositing) e quali modifiche sono costose.
Risposta di esempio in inglese da esercitare ad alta voceThe browser parses the HTML into the DOM and the CSS into a style model. It combines them to find out what is visible and which styles apply. Then it does layout, which calculates the size and position of every element, then paint, which draws the pixels, and finally compositing, which puts the layers together. Layout is the expensive part. If I change something that affects geometry, like width or position, the browser may recalculate the layout for many elements. Changes to transform and opacity are usually cheaper, because the browser can often handle them in the compositing step. Also, scripts in the head can block rendering, so I load non-critical ones with defer or async.
How does asynchronous code work in JavaScript?
Come funziona il codice asincrono in JavaScript?
Che cosa vuole sentire l'intervistatore. Un solo thread principale, l'event loop, la differenza tra task e callback delle promise e la regola pratica di non bloccare mai il thread.
Risposta di esempio in inglese da esercitare ad alta voceJavaScript runs on one main thread, so it does one thing at a time. When I start something slow, like a network request, the browser does the waiting outside the main thread. When the work finishes, a callback goes into a queue. The event loop takes work from the queue when the call stack is empty. Promise callbacks use a separate microtask queue, which runs before the next regular task. The async and await syntax sits on top of promises and makes asynchronous code look sequential. The practical rule is to never block the main thread with a long loop, because the page freezes. I also always handle errors, with try and catch or with a catch on the promise.
How do you manage state in a frontend application?
Come gestisci lo stato in un'applicazione frontend?
Che cosa vuole sentire l'intervistatore. Diversi tipi di stato (locale, condiviso, del server, nell'URL) e il principio di un'unica fonte di verità, senza nominare una libreria specifica.
Risposta di esempio in inglese da esercitare ad alta voceI separate state by type. Local state, like whether a dropdown is open, stays inside the component. Shared client state, like the current user or a shopping cart, may need a central store or a shared context. Server state, like a list loaded from an API, is different. It needs caching, loading and error handling, and refetching, so I use a data-fetching layer for it and do not copy it into a global store. The URL is also state: filters and page numbers belong there, so users can share links. My rule is to keep state close to where it is used, and to have one source of truth for every piece of data.
A page loads slowly. How do you find the cause and fix it?
Una pagina si carica lentamente. Come trovi la causa e la correggi?
Che cosa vuole sentire l'intervistatore. Un metodo che parte dalla misurazione, i Core Web Vitals come cornice e più correzioni concrete, con una verifica finale.
Risposta di esempio in inglese da esercitare ad alta voceI start by measuring, not guessing. I use the performance tools of the browser to see the loading time, and field data if I have it. The Core Web Vitals give a good frame: how fast the main content appears, how quickly the page responds to input, and whether the layout jumps. Common fixes are sending less JavaScript by splitting the bundle, compressing and resizing images, loading things below the fold lazily, caching static files with a CDN, and reserving space for images to avoid layout shifts. After each change, I measure again, because an optimisation that I cannot measure may not help.
How do you make a web page accessible?
Come rendi accessibile una pagina web?
Che cosa vuole sentire l'intervistatore. Prima l'HTML semantico, il supporto da tastiera, contrasto e alternative testuali, un uso attento di ARIA e test manuali.
Risposta di esempio in inglese da esercitare ad alta voceAccessibility means that people can use the page with a keyboard, a screen reader or other assistive technology, and with different abilities. I start with semantic HTML: a real button for actions, a link for navigation, proper headings and labels for form fields. Native elements give keyboard support and the right role for free. I check that everything works with the keyboard alone, with a visible focus. I keep enough colour contrast and I write a meaningful alt text for images. I use ARIA only when native HTML is not enough, because wrong ARIA is worse than none. I test with automated tools and also by hand, because tools find only part of the problems.
Come pronunciare i termini chiave
- JavaScript
- già-va-script
- DOM
- di-ou-èm (si dice lettera per lettera)
- asynchronous
- ei-sìn-cra-nos
- accessibility
- ac-sès-i-bìl-i-ti
- semantic
- si-màn-tic
- responsive
- ri-spòn-siv
- viewport
- viù-pòrt
Frasi utili per rispondere
- I would measure it first with the performance tools.Prima lo misurerei con gli strumenti di performance.
- That change triggers a layout recalculation.Quella modifica fa ricalcolare il layout.
- The state should live as close as possible to where it is used.Lo stato dovrebbe vivere il più vicino possibile a dove viene usato.
- I would use a native element here, because it is accessible by default.Qui userei un elemento nativo, perché è accessibile per impostazione predefinita.
- The main thread is blocked, so the page freezes.Il thread principale è bloccato, quindi la pagina si blocca.
- It depends on whether the data is local or comes from the server.Dipende dal fatto che i dati siano locali o arrivino dal server.
- From the point of view of the user, what changes?Dal punto di vista dell'utente, che cosa cambia?
Errori comuni da evitare
- Spiegare solo un framework. Se dici "the framework updates the screen", di' anche che cosa fa il browser sotto. Gli intervistatori verificano prima le basi.
- Dire "Java" quando intendi "JavaScript". Sono linguaggi diversi e confonderli sembra sbadato. Pronuncia chiaramente JAH-vuh-skript.
- Ottimizzare senza misurare. Di' quale strumento useresti e quale numero guarderesti prima e dopo.
- Trattare l'accessibilità come un extra di fine progetto. Di' che la costruisci fin dall'inizio, con HTML semantico e test da tastiera.
- Usare l'aggettivo al posto dell'avverbio, come in italiano «la pagina carica lento»: "the page loads slow" o "it works good". Di' "the page loads slowly" e "it works well".
Domande frequenti
Quale framework devo dire di conoscere?
Nomina quello che hai usato in un progetto reale e di' come lo hai usato. Molti intervistatori danno più peso alle basi di HTML, CSS e JavaScript e poi verificano se le hai applicate bene nel framework.
Come spiego il layout CSS in un colloquio?
Di' che Flexbox serve per un layout in una dimensione, una riga o una colonna, mentre Grid serve per due dimensioni, righe e colonne insieme. Spesso si usano entrambi nella stessa pagina. Cita il box model e il responsive design con le media query e porta un esempio dal tuo lavoro.
Dovrò scrivere codice dal vivo?
Spesso sì: un piccolo componente o una funzione con codice asincrono. Di' il tuo piano ad alta voce: prima la struttura in HTML, poi gli stili, poi il comportamento. Cita lo stato vuoto, lo stato di caricamento e la tastiera, perché mostrano esperienza.
Leggere una risposta non è la stessa cosa che dirla. Esercita ogni domanda ad alta voce, poi confronta il significato e la lingua della tua risposta.
Prova SpeakRole ↗Altri argomenti in quest’area