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.
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.
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.
Now, let's simulate the question. I hope it can help you to understand the VanillaJS and to pass this kind of interview.
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.
Add an attribute
onload="read()" to the
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.
id to the
textarea and add attribute
onclick="create()" to the
button. We remove the existing list then add the list to prevent duplication.
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.
We put an unique id in the list item and use it to remove the element.
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.