A glimpse into the front end interview process and questions that frequently come up.
Interview Process
Applying for front end engineer roles is very similar to software engineer roles, but the interviews can be quite different. In my experience, for each company, there tend to be between 3 to 4 sessions. Most of them will be testing on JavaScript and discussion around web development technologies, and the rest on algorithms or behavioral.
One aspect that I have found interesting is that the younger the company, the more questions will lean towards JavaScript. This could be because hiring specifically for front end engineers is relatively new. Older companies used to only hire software engineers without regard to whether their focus was on the back end or front end.
JavaScript Rounds
JavaScript is the main focus among all the companies I have interviewed with. It makes sense as front end work nowadays is very JavaScript-heavy. HTML and CSS knowledge is no longer a necessity thanks to component libraries and the likes.
JavaScript Minutiae
To qualify for some companies, you might need to brush up on the minutiae of JavaScript. Topics like variable hoisting, holey arrays, non-strict mode, and switch case fall through came up. While I do not feel that knowing such things determine who is a better engineer, it is what it is. Here is my JavaScript cheat sheet.
JavaScript Topics
After the first assessment, live interviews tend to test on more advanced JavaScript concepts such as the event loop, promises, async/await, scope and closures.
If you have been writing JavaScript applications for some time and have come across a variety of situations, this should not be too hard.
The most frequently asked question I have ever gotten is to implement debounce and throttle:
function debounce(fn, duration) {
let id;
return function (...args) {
if (id) {
// reset timeout and prevent it from triggering
// if debounced function is called within duration
clearTimeout(id);
}
id = setTimeout(() => {
fn(...args);
}, duration);
};
}
function throttle(fn, duration) {
let id;
return function (...args) {
if (id) {
// if throttled function is called within duration,
// do nothing
return;
}
fn(...args);
id = setTimeout(() => {
id = null; // release "lock"
}, duration);
};
}
// usage example
const helloWorld = () => {
console.log('hello world');
};
const debouncedHelloWorld = debounce(helloWorld, 1000);
const throttledHelloWorld = throttle(helloWorld, 1000);
The second most frequently asked question is to implement a sequential Promise.all of sorts:
function sequential(data, fetcher) {
const helper = (index, results) => {
if (index === data.length) {
return results;
}
return fetcher(data[index]).then((datum) => {
results.push(datum);
return helper(index + 1, results);
});
};
return helper(0, []);
}
// usage example
const fetcher = (i) => {
return new Promise((resolve) => {
setTimeout(() => resolve(i), 1000);
});
};
sequential([1, 2, 3], fetcher);
