Bad questions for Senior Frontend Dev Interview
Tags: career, webdev, interview
Published: 2024-04-08 06:11:51


#### How the interview process has turned into a generic ChatGPT template where your experience doesn’t matter because you’re just being run through a checklist of questions


---


## Everything described below is my subjective opinion

This story is not a direct guide for candidates and serves as a reflection on current technical interviews. It is up to you to decide what to do with this information

I aim to tell how popular interview questions, which can be freely found in the search results, do not have any practical application, and for me, there are signs of the negligence of the company in the selection of candidates. By doing so, any team can lose all Senior developers because there won’t be any relevant questions asked

I understand that the interview can be abstract if the hiring process is being held by a large company where the technical interviewer is not a part of the target team or project, and it’s just one step in a large selection process.

These questions are more relevant to the hiring process for small to medium-sized companies on the employment scheme

* HR Interview (0.5–1h) — Technical Interview (1.5–2h) — Manager Interview (Optional) — Offer

I don’t rule out that the questions I’ve outlined have come across time and time again only to me and are my poor choice of company to interview with. I only mention  some of the questions, but not the interview itself or the approach, and also suggest alternative questions for a particular topic.

---


## How does the Event Loop Work?
>  At this point you close the page, because everything is clear — the author is dumb.

This is the most annoying question from any job interview for any level. But aren’t you tired of answering this question yourself every time?

Yes, of course, you can memorize the answer like an article from the Bible and calmly answer — *There is some event, it is put into Call Queue, then into Call Stack and blah, blah, blah.*

You have successfully told about the Event Loop and received the coveted checkmark ✅. Next question.

### Do you understand why JS needs this mechanism?

The basic understanding of the Event loop is not to answer “*How is asynchrony provided in JS?*” but “*Why is asynchrony provided in JS via the Event loop?*”.

These are two principally different questions. Do you feel the difference? The second question relies on your experience, perception and outlook in development, where the keyword will be “single-threadedness” in your answer. 

But basic interview guides from the internet and the popularization of Frontend development have led to the formalization of the main points, trying to pass off desired knowledge as actual knowledge

![replacing "event loop assignment" to "how event loop works"](https://cdn-images-1.medium.com/max/2888/0*zSQSg078B_2i_-Gr)

Try asking, "*How to bypass the ‘single-threadedness’ limitation in JS and do computation in a separate thread?*”

Does knowing “Call Stack” or “Call Queue” help you? — No. I guess it’s something to think about

---


## Microtask and Macrotask execution queue

You have successfully answered the standard Event loop question and you are given a new task — “*In what order will the numbers be output to the console ?*”

```javascript
console.log(1);
    
setTimeout(() => console.log(2));
    
Promise.resolve().then(() => console.log(3));
    
Promise.resolve().then(() => setTimeout(() => console.log(4)));
    
Promise.resolve().then(() => console.log(5));
    
setTimeout(() => console.log(6));
    
console.log(7);
```

![Do you smell that? Unreal code, son. Nothing else in the world smells like that.](https://cdn-images-1.medium.com/max/2000/0*c3PXF0UTJJa_1W8n)

> Do you smell that? Unreal code, son. Nothing else in the world smells like that.

Even if you’re a Node.js developer — How often does your code have an “execution race”? You don’t understand when your code is synchronous and asynchronous?

The answer to this task is not even responsible for understanding `microtask` and `macrotask`, and their impact on rendering in the browser.

With knowledge of the execution priority in `console.log`, can you answer these questions?:

* *How to ensure that the interface is fast and smooth even with multiple concurrent events in it*?

* *What is the point of using* `requestAnimationFrame`?

* *How can you block the whole interface and further interaction with it when clicked, and how to avoid it*?

---


## Arrow functions vs regular functions

There is nothing wrong with this question, but it depends on who is asking it. If you answer “*about the accessibility of outer this context and accessibility of function for executing*” — that’s enough for me. (Yes, you can also mention the use of arguments)

But the question is being asked not by a simple interviewer, but by that “school nerd” who can’t get enough of your answer. You sit in awkward silence, and he is waiting for the difference between the two ways of declaring a function, and doesn’t give even a hint, because “**the senior dev must know everything!**”.

![Give me, give me more](https://cdn-images-1.medium.com/max/2400/0*QjmAxE1F2G5rwN0_)

> Give me, give me more

What’s he waiting for? — He’s waiting for you to talk about using `constructor` in regular functions. Yes yes, it’s 2024 and we have to discuss ES5 syntax.

Tell me, how often do you use this construction?
```javascript
    function RegularFuncBird(name, color) {
      this.name = name
      this.species = color
      console.log(this)
    }
    
    new RegularFuncBird("Parrot", "blue")
```
Classes? — c’mon, who needs them ?! — FUNCTIONS.

Yes, you can say that “*classes in JS are ‘syntactical sugar’ and it’s a way to pay homage to the old days*”. 

But let’s be honest, this knowledge is not relevant today. If a candidate has told you the practical ways and the difference in usage — that’s enough for the work. 

**Don’t be a nerd, your historical knowledge is only for you. Progress does not stand still and new knowledge is replaced by others**

---


## Var vs const & let

Since I started the topic about ES5 syntax, I’ll continue.

Another one of the popular interview questions. You are asked about it, and the discussion begins with which `var` is bad — popping up, contexts and problems, and `const` and `let` are good ones

![You memorized a lot of mock interview answers and waited for this question.](https://cdn-images-1.medium.com/max/2048/0*FthI3KfKSDmyo4v1)

> You memorized a lot of mock interview answers and waited for this question

What is the practical value of this question? — minimally

Can I think that the company has projects with `var`? — yes

We can discuss for a long time how bad `var` is, but if you really care about this question of variables, you’d better ask:

* *About* `const` *working with objects and arrays*

* *How the candidate understands the “const first” principle*

In my opinion, the candidate’s answers will cover a lot of use cases and will give a clear picture of the candidate’s understanding of how this syntax works.

---


## Detecting Memory Leaks

In one of my job interviews, I got an interesting question — “*You come on a project and immediately look for memory leaks in the application, but it’s not you who will do this task, it’s QA. How would you describe the process of finding memory leaks to him?*”
>  Wow. Unconventional wording of the question, because the interview usually indirectly describes the current problems of the project without telling you directly. But the funny thing is, my answer about “*analyzing application snapshots through the profiler*” was wrong. I still don’t know what the person wanted to hear from me

Anyway, if we abstract from the situation and try to understand the question, it appears that **it describes the solution and the search for consequences, but not the prevention of causes**.

![i like resolve problems](https://cdn-images-1.medium.com/max/2000/1*PgVMT2XSdsOaWJtAvrqGVQ.jpeg)

Yes, you have found a memory fragment increasing with time, you have found a code area with a leak, and you don’t know what to do further, because you only know how to run the profiler.

In my opinion, the better question is — “*how to write safe code that does not generate memory leaks ?*”

The main points to be covered:

* `addEventListener('event', handler)` -> `removeEventListener('event', handler)`

* `const interval_Id = setInterval()` -> `cleanInterval(interval_Id)`

* Understanding of “garbage collector” and long-lived refs.

**You don’t need to know all about “how to find and fix consequences?” if you know “how not to cause problems?”**


---


## Types in Javascript

My favourite section for useless questions:

* What are the main types of JS?

* Why is `null` the object?

* What is `Symbol` and how to use it?

* What is `prototype`?

* What is the difference between `Number(num)` and `new Number(num)`?

* Why are there artefacts in the remainder when adding fractional numbers?

* How to make `a == 1 && a == 2 && a == 3` ?

You, as a Senior frontend developer, sit in an interview like this:

![Yeah, dude. Not a single day goes by without me not using this syntax when developing web apps](https://cdn-images-1.medium.com/max/2000/0*mAPB863gF_uI7LTw.jpg)

> Yeah, dude. Not a single day goes by without me not using this syntax when developing web apps

This list can go on and on, but the answers to these questions are not necessary for developing reliable and functional front-end applications. 

If you want to hear a candidate’s understanding of working with “types”, you should ask a list of questions like this:

* *How do you make sure that a `value` is an array?*

* *What are some ways to cast the value to* `boolean` *type?*

* *Where do the* `toString()` *and* `toJSON()` *methods come from?*

* *Why is it better to use* `obj.hasOwnProperty(key)` *instead of* `obj.key` *?*

* *What are the peculiarities of working with fractional numbers and displaying their result?*

* *Why should* `NaN.isNaN()` *be used?*

---


## CORS

Anyone who has ever developed an application with integration to some service has gotten this error. All you need to know about the CORS mechanism is that the browser checks the correspondence between the allowed domains for calling the service and the current domain.

You can find the historical part and the reasons for the appearance [here](https://aws.amazon.com/what-is/cross-origin-resource-sharing/?nc1=h_ls)

### What could go wrong here? 

You can get the question - “*Why is the HTTP OPTIONS request used ?*”
>  You don’t know? — It’s okay, don’t worry. You remain a good front-end developer. I give you answer

Calling HTTP OPTIONS is browser logic for getting allow HTTP methods from the service for requests to it, **which you cannot influence in the final build from the user, and do not organize in any way yourself**

### The right question about CORS

“*What are the ways to bypass CORS policies in the browser during development ?*”

This question can show that you are familiar with this error and you can suggest solutions to your colleagues. You can suggest your own variants:

* Proxy config

* Special browser extension

* Disabling browser policies

**Knowing** “*Why is the HTTP OPTIONS request used?*” **won’t eliminate blocker problems when integrating a front app in development because you don’t develop the backend part**

---


## In conclusion

The technical interview is a two-way process to understand how future tasks and your experience can be used for the best advantage of each other, rather than sitting for 2 hours taking a theoretical exam disconnected from reality.

Checking the basic things that are required for Junior and Middle selection are not applicable for Senior developers. First and foremost, a Senior developer is about the experience with mistakes. 

Based on my suggested questions, ask yourself —  “*What kind of candidate would I like to get*? *The one who answers the theory or the one who applies it?*” All stakeholders will benefit from this decision because the project will really have people with experience, not just “sets of knowledge”.

Still, **my proposal will not cover the main problem — only one technical interview for the Senior Frontend Developer role**. In 2 hours of interviews, you won’t learn about the candidate’s skills in system design, and you won’t be able to devote much time to “live coding” and spend time on theory.
> **But hopefully, it will help**

### P.S.

I don’t exclude that I will make a second part about CSS questions if you like this article