Why they ask this: Tests recursion and how you handle data of unknown depth, which is common with JSON from APIs.
Given an array that can contain numbers and other arrays nested to any depth, return a single flat array with all the values in their original order. Example
Why they ask this: Deadlines are constant in software jobs; interviewers want to see prioritisation and calm, not heroics.
How to answer
Show how you prioritised, communicated early about risks, and delivered something useful, even if that meant reducing scope.
Avoid: stories that rely on skipping sleep for days as the main strategy, or a deadline you missed without learning anything.
Sample answer · STAR
Why they ask this: Common in search boxes, scroll and resize handlers; shows you think about performance.
Answer
Why they ask this: Technology changes constantly, so companies hire juniors who can learn on their own.
How to answer
Sample answer · STAR
Why they ask this: Most React bugs (infinite loops, stale data, memory leaks) come from misusing useEffect.
Answer
Why they ask this: Forms are in every app; this shows how you handle user input and validation.
Answer
Why they ask this: Explains "why is my style not applying?" problems that every frontend developer hits.
Answer
Why they ask this: Accessibility is increasingly expected; it shows care for all users and code quality.
Answer
Why they ask this: Middleware is how cross-cutting concerns like auth are handled; it shows you understand the request lifecycle.
Answer
Why they ask this: Shows you know how to keep web requests fast and handle slow work reliably.
Answer
Why they ask this: Most Nepali startups build an API for a React or mobile frontend, so you must know which auth fits.
Answer
Situation: During my internship, a client needed an event-registration form live in three days for a conference in Kathmandu, and the developer who started it had fallen sick.
Task: I had to finish the form, the admin list and the confirmation emails.
Action: On the first morning I listed every remaining task and agreed with my supervisor which were must-haves (registration, validation, confirmation email) and which could wait (CSV export, payment integration). I posted a short progress update every evening and flagged on day two that email delivery needed the client's SMTP details, so we got them in time.
Result: The must-have features went live a day early, more than 400 people registered, and we added the CSV export the following week. I learnt that agreeing on priorities and raising blockers early matters more than working longer hours.
Both limit how often a function runs:
function debounce(fn, delay = 300) {
let timer;
return (...args) => {
clearTimeout(timer);
timer = setTimeout(() => fn(...args), delay);
};
}
const onSearch = debounce((q) => fetch(`/api/search?q=${encodeURIComponent(q)}`));Describe how you learn: official documentation, a small proof of concept, asking for help at the right moment. Then show the result of applying it.
Avoid: only listing courses or certificates without showing that you used the skill.
Situation: In my internship, the team decided to add push notifications to their Flutter app, and nobody had used Firebase Cloud Messaging before.
Task: My mentor asked me to research it and build a working prototype within one week.
Action: I read the official FlutterFire documentation first, then built a tiny separate app that only received a test notification. Once that worked, I wrote down the setup steps for Android and iOS and the problems I hit, such as notification permissions on Android 13. I asked a senior for a 20-minute review before integrating it into the main app.
Result: The prototype worked on day four, the feature shipped in the next release, and my setup notes became the team's internal guide. My approach now is always: documentation, a tiny prototype, notes, and then integration.
useEffect(effect, deps) runs effect after render:
[]: runs once after the first render (mount).[a, b]: runs after the first render and again whenever a or b changes (compared with Object.is).The function you return is the cleanup. It runs before the effect runs again and when the component unmounts. Use it to remove listeners, clear timers and cancel requests.
useEffect(() => {
const controller = new AbortController();
fetch(`/api/jobs?q=${query}`, { signal: controller.signal })
.then((r) => r.json())
.then(setJobs)
.catch(() => {});
return () => controller.abort(); // cancel the old request when query changes
}, [query]);Include every value from the component that the effect uses in the array. Missing dependencies cause stale values.
value comes from state and every change goes through onChange.ref or from the form data on submit.// Controlled
const [email, setEmail] = useState('');
<input value={email} onChange={(e) => setEmail(e.target.value)} />
// Uncontrolled
const inputRef = useRef(null);
<input ref={inputRef} defaultValue="" />
// later: inputRef.current.valueChoose controlled inputs for instant validation, formatting or conditional UI. Uncontrolled inputs are simpler for basic forms and file inputs (<input type="file"> is always uncontrolled). Form libraries such as React Hook Form mostly use uncontrolled inputs for performance.
When several rules target the same element, the browser picks the one with the highest specificity. If specificity is equal, the rule that appears later wins.
Specificity is compared as (IDs, classes/attributes/pseudo-classes, elements/pseudo-elements):
| Selector | Specificity |
|---|---|
p | (0, 0, 1) |
.card p | (0, 1, 1) |
#main .card p | (1, 1, 1) |
inline style="" | beats any selector |
!important | overrides normal declarations; avoid it |
:where() adds zero specificity, while :is() and :not() take the specificity of their most specific argument.
Keep specificity low and flat (for example single classes with a BEM-style or utility approach) so styles stay easy to override.
<button>, <nav>, <main>, headings in order) before reaching for ARIA.alt text (alt="" for decorative images).<label> (for/id, or wrap the input).:focus-visible style.aria-expanded on a menu toggle or aria-live for status messages.Check your work with Lighthouse or axe DevTools and by navigating with only the keyboard.
Middleware is a layer that every matching HTTP request passes through before it reaches the controller, and the response passes back through after. Each middleware can let the request continue ($next($request)), change it, or stop it early.
Common uses:
auth / auth:sanctum reject guests./admin.throttle:60,1.class EnsureUserIsAdmin
{
public function handle(Request $request, Closure $next): Response
{
if (! $request->user()?->is_admin) {
abort(403);
}
return $next($request);
}
}
Route::middleware(['auth', EnsureUserIsAdmin::class])->group(function () {
Route::get('/admin', AdminDashboardController::class);
});DB::select('select * from users where email = ?', [$email]). Never concatenate input into whereRaw.{{ $value }} escapes output with htmlspecialchars. Only use {!! $value !!} for HTML you have sanitised.@csrf inside Blade forms. Token-authenticated APIs (for example Sanctum tokens) are not exposed to CSRF in the same way.Also mention: mass assignment protection with $fillable, validation with Form Requests, hashing passwords with Hash::make (bcrypt or argon2), and authorisation with policies.
A job is a class that does one piece of work. A queue stores jobs so that a separate worker process (php artisan queue:work) runs them in the background.
Use queues for anything slow or unreliable that the user should not wait for:
class SendWelcomeEmail implements ShouldQueue
{
use Queueable;
public int $tries = 3;
public function __construct(public User $user) {}
public function handle(): void
{
Mail::to($this->user)->send(new WelcomeMail($this->user));
}
}
SendWelcomeEmail::dispatch($user);Queue drivers include database, redis and Amazon SQS. Failed jobs are stored and can be retried with php artisan queue:retry. In production, keep the worker running with Supervisor (or a platform's worker process) and restart it after each deploy.
Authorization: Bearer <token> header. This suits mobile apps and third-party clients.
In Laravel, Sanctum handles both: cookie-based SPA authentication for your own frontend and API tokens for mobile apps. Never store tokens where scripts can read them (such as localStorage) if you can use an httpOnly cookie instead.