Interviewing ChatGPT for a Front-End Developer Position

Interviewing ChatGPT for a Front-End Developer Position

Only a couple of months have passed since ChatGPT was released to the public, and it's already gaining a lot of attention for its detailed responses and articulate answers across many domains of knowledge.

It’s evident from its homepage that it was trained to interact in a conversational way and its ability to understand code, which makes it an excellent candidate for a Software development interview. I thought that this would be a nice experiment. Let’s spend some time exploring what the future of AI will look like.

First, let's ask for permission to conduct this interview.

Impressive! The disclaimer is spot on, and if you ignore the fact of having the interviewee suggest the questions, all of them would be relevant for a front-end interview.

But I will not use them. Over the past few years, I have created my own question bank as part of my interviewing duties for my current employer. This way, we can test it with unexpected questions and maybe improve its models a bit.

Fun fact: the last 3 suggestions are actually part of my own question bank!

The interview

The questions are from 5 topics: Javascript, CSS, Computer science fundamentals, coding & collaboration, and architecture. I will ask a couple from each section. Please notice that this is the first part of the interview, and the questions should be easy. Usually, half of the candidates can answer them correctly. This part is followed by more advanced live coding, application architecture and behavioural interview steps.

Javascript

What are the different ways to declare a variable in javascript?

And it starts with a bang! The answer completely covers my minimal accepted answer and even explains a bit of scoping, which I sometimes have to follow up on.

It leaves some ambiguity around const scoping, which I followed up on.

And it delivered. Correct answer, helpful examples and articulate sentences. I will give it full points for this.

What is the difference between == and ===?

Another trivial question that most interviewees are able to answer. Still goes the extra mile to explain coercion and recommends strict operator to be used. Full points. Time for something more tricky.

What does this example print:

This question has many people thinking, and even though most answers are correct, a solid line-by-line explanation like this is rare.

Follow-up: How do we make b.name hold its original value?

Again excellent answer with helpful working snippets. Full points.

CSS

Obviously, ChatGPT did its Javascript homework. Let's see if its equally strong in CSS.

What are the differences between ‘visibility: hidden’ and ‘display: none’? When would you use each one?

Excellent answer and paradigm again.

How do you align a div in the centre of another div?

Excellent CSS skills it is. Full points. Let's try some more advanced topics.

CS fundamentals

Can you name some data structures you are familiar with and give me use-case examples?

This is actually a better answer than my notes. Manages to mention the five most common data structures with excellent working examples makes my follow-up of explaining how to implement one of them irrelevant.

What principles do you know to make software scalable and maintainable?

SOLID answer (pun intended)

Coding & collaboration

Why should one merge frequently?

Somehow the bot learned about optimal ways of working and gave great advice on why to merge often.

What is a unit test? What are the characteristics of a good unit test?

FE Engineering

Autocomplete widget

Talk me through the implementation of an autocomplete widget. A user can type text into it, and get back results from a server. How would you design a frontend to support the following features.

It goes from a high level of understanding of the requirements to a low level of choosing an unordered list to display the results and attach event handlers to it. I'm pretty convinced that it could implement it if asked, but I would like denounced to be mentioned. Let me follow up on this.

Can you improve the performance of the above implementation?

Not only remembers the context of the previous question but mentions debounce along with caching and asynchronous loading. I'm covered.

Evaluation

After each interview, I have a scorecard to fill out about the candidate’s performance. This is to demonstrate his strong and weak points and decide if he advances to the next stage.

ChatGPT managed to answer all of my answers correctly. Giving solid explanations each time, along with helpful and functional code snippets. It was able to understand my follow-up and expand the answer when needed. Demonstrated strong Javascript knowledge and Computer Science fundamentals, using natural and intuitive communication through engaging conversations.

Evaluation: Strong YES!

Conclusion

The future is here! Looks impressive and sometimes scary, but the potential of a tool like this is incredible. Breakthroughs in many fields can be initiated and assisted by it, and many tools will emerge and be part of our day-to-day lives. Similar to GitHub copilot, which I already love.

Of course, as part of the generation that grew up watching Terminator and Matrix, having a machine answering questions better than me is a bit intimidating. Still, I'm optimistic, and I hope you are too. Head over to ChatGPT if you want to test it yourself, and I hope you learned something useful in case you prepare for an interview. ✌️