Cracking Front-End Interview - Part 2
I applied for a Full-Stack position at one of the biggest startups in Southeast Asia a long time ago. I got an extra interview for Front-End. Here is how I solved it.
Resume
The resume does matter. In my previous article, I got the interview because I put my portfolio on the resume. At this interview, I put my professional experience. It does matter a lot. I think it is also good to put side projects on the resume if you have them. I felt a little lucky that they responded to my resume because they are a large and international company.
Algorithms and Data Structures Interview
The first interview I got was Algorithms and Data Structures. I hardly remember that maybe I got 3-5 questions in HackerRank. Some companies use Codility for this kind of interview. I solved those questions using Go.
You have to solve them in a given time. It is about 1-2 hours. I forgot the exact given time. I suggest getting practice if you are not familiar with this kind of interview. I practice on LeetCode.
Front-End Interview
Finally, I got the Front-End interview after solved the first interview, Algorithms and Data Structures. I also got the final interview after the Front-End interview. The final one is about the system, personal, and live coding too.
The Front-End interview is about live coding interview. The recruiter gave me the question after a little chit-chat. I forgot the exact question but the point is to implement CRUD (Create Read Update Delete) operations to manipulate DOM (Document Object Model) or HTML using JavaScript. You can use any framework or tool such as jQuery, React, Angular, etc. But I chose VanillaJS or pure JavaScript. I need to solve the question within 1 hour. I was free to ask any question to help me out with the recruiter. But it is better not to ask because the question or instruction was clear enough.
Now, let's simulate the question. I hope it can help you to understand the VanillaJS and to pass this kind of interview.
Get Started
We are going to create a web app that manipulates articles. Let's create three files:
- index.html is where you need to manipulate.
- data.json is the data.
- app.js is your work.
|
|
|
|
Read
|
|
Add an attribute onload="read()"
to the body
and id="list"
to the ul
. We will load the data and put them in the body or list. The entry
is a function to render the HTML or list item.
Create
Let's put id
to the input
and textarea
and add attribute onclick="create()"
to the button
. We remove the existing list then add the list to prevent duplication.
|
|
Update
The update is all about filling form fields with existing values. Because in create, we remove the old list and add the new version of the list.
|
|
Delete
We put an unique id in the list item and use it to remove the element.
|
|
Closing
Choosing VanillaJS for this kind of interview is awesome I think. It is impressive. We work under pressure or at a given time using pure JavaScript which is not many Front-End developers are familiar.
As you see, even VanillaJS, our code is still simple enough and easy to understand. It is not difficult as many people think. I got an impressive review from the recruiter after solved the question this way. You can find the full code at https://github.com/aristorinjuang/vanillajs.