Why most Front End Dev interviews (#JavaScript #Typescript) are Shit
Tags: interviewquestions, typescript, interview, management
Published: 2017-10-27 12:36:41

---
title: "Why most Front End Dev interviews (#JavaScript #Typescript) are Shit"
published: true
tags: interview-questions,typescript,interview,management
canonical_url: https://hackernoon.com/why-most-front-end-dev-interviews-javascript-typescript-are-shit-87d137d73229
---

![](https://cdn-images-1.medium.com/max/1024/1*IxX3zeSViow1so2z-w8OcA.png)<figcaption>image used from <a href="http://blog.debugme.eu">http://blog.debugme.eu</a></figcaption>

I am sorry I din’t censored shit, but shit pretty much === s\*\*t and everyone would know what I mean either&nbsp;way.

### First of all a bit of a back&nbsp;story

I am changing my job ( wohoo for me and ohno for my team). I was dev, I became a TL, we were a dev team, then we became game team (dev, interface and animation) a while ago, then I decided to quit (if you want to know why, feel free to ask, it is npt the point of the article). A friend of mine, works in a company that works the same field as my current company and wouldn’t stop bothering me until I gave their company a shot. His company however was looking for a senior game/front end dev. Considering that I have worked at my current company for nearly 6 years, I decided to give a shot, if only to see firsthand how the current market for developers was, outside of my&nbsp;company.

### Second

both companies should, in my opinion, stay unnamed. Just assume they are generic companies.

### Third

Lets call them interview problems, seen from TL and dev perspective, when a TL tries a dev interview. It may sound weird or strange, but it is a nice perspective of a guy that has made interviews with devs in a company and the same guy trying an interview as a dev in another&nbsp;company.

### Fourth

I will split this into two parts. _You will know why in a&nbsp;bit._

### Fourth point oneâ€Š–â€Šhuman&nbsp;parts

The interview was first conducted with the person, which represents the dev team and their manager. Their manager, of course focused on my career, what I have done, how much (as a percentage) did my job as a TL allowed me to write code, with what IDEs did I write my code, what were my side projects, why did I wrote them in those programming languages and so on. It was pretty understandable. However, I expected more of their dev TL. He had two questions, for about of an hour of interview. Question oneâ€Š–â€Šhave you used Gulp; and question twoâ€Š–â€Šwhat is your approach in learning new technology or new API or new framework, etc.

Apparently I did good enough impression to be asked to make a test at the company. I wasn’t sure whether or not it was the psychological test, the test to be sure how much info I will be allowed to know and not leek outside, or the tech test. I went there, talk with their manager. He was a pretty nice guy with understanding, reasonable motives and so on. I found out it was the technical test that I was about to do. Which was OK, it isn’t like I was going to study for it anyway. The following are my impressions of the&nbsp;test.

### Fourth point twoâ€Š–â€Štest

#### Disappointment one

It is only the test. You don’t talk with devs, their team lead, an architect or anyone else. **It. Is. Just. The.&nbsp;Test.**

#### Disappointment twoâ€Š–â€Šthe test&nbsp;itself

_These aren’t typos or writing mistakes. Everything is written as it was in the&nbsp;test._

The test is a three pages piece. It is spitted in Java Script, Node.js & Gulp, TypeScript.

Now to the questions. Some are omitted in order to avoid repetition.

#### Questions about JavasScript

1. What is a potential pitfall with using typeof bar === â€˜object’ to determine if bar is an object? how can this pitfall be avoided?  
_Answer:_ Welcome to [2015–6](http://developer-interview.com/p/javascript/what-is-a-potential-pitfall-with-using-typeof-bar-object-to-determine-if-bar-is-an-object-how-can-this-pitfall-be-avoided-36) questions on forums. It is a reliable way, but typeof bar === â€˜object’ returns true. Keep it in mind. You will rarely (never) use it a t work, but it is apparently a very common JS question for interview and&nbsp;tests.
2. What is NaN? What is its type? How can you reliably test if a value is equal to NaN?   
_Answer:_ Again with the obvious old questions. [NaN stand for Not A Number.](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/NaN)It’s type however is number, because JavaScript is JavaScript. If you want to test if something is NaN, JavaScript has [isNan method](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/isNaN) to do so. It is not intuitive or very common to use it, but it&nbsp;exists.
3. In what order will the numbers 1–4 be logged to the console when the code below is executed? why?

```
(function(){
    console.log(1);
    setTimeout( function(){ console.log(2)}, 1000);
    setTimeout( function(){ console.log(3)}, 0 );
    console.log( 4 );
})();
```

The answer again is old. A variant of it can be found [here](https://stackoverflow.com/questions/28115853/settimeoutfunctionconsole-log3-0-it-has-value-0) with nice explanations.   
Basicallyâ€Š–â€Šthe browser interpreting the function will go like this:  
I have to write 1  
I have to write 2 in a while  
I have to write 3 in while. The fact the timeout is set with 0ms doesn’t matter. If you have used JS event base management with setTimeout(0) you will know when to use **this tremendously ugly fix** (don’t ever use it!).  
I have to write 4  
The function does not return anything so the browser will output “undefined”  
I **had** to write 3 in 0ms, so the “3” is logged  
I **had** to write 2 in a 1000ms, so the “2” is logged.  
Your whole answer isâ€Š–â€Š1,4 undefined, 3,&nbsp;2

5. What will the code bellow output? Explain your&nbsp;answer.

```
console.log( 0.1 + 0.2 );
console.log( 0.1 + 0.2 == 0.3 );
```

What do you think 0.1 + 0.2 results in JavaScript? 0.3? **Hell no!** JS is famous for its float arithmetic problems. 0.1 = 0.2 results in 0.30000000000000004 (with more or less zeroes here and there).  
_So, your answers are:_ **0.30000000000000004** and&nbsp; **false**

6. What will be the output of the following code:

```
for( var i = 0; i < 5; i++){
    setTimeout( function(){ console.log( i ); }, i * 1000 );
}
```

Well, welcome to 2016–7 generic question about JS, setTimeouts and closures. It is the first question in [this article](https://medium.com/coderbyte/a-tricky-javascript-interview-question-asked-by-google-and-amazon-48d212890703). Yes, there are other articles, that summarize what people get asked on JS interview, this one is just a bit more detailed and written from the perspective on someone who made dev interviews, and someone who just went to a dev interview.  
I have seen this in so many articles it literally hurts. If anyone has read something about the language at any point he/she can answer without understanding it at all. A lot better question, in my opinion, is thisâ€Š–â€ŠExplain what a closure is and why would you use it. Give at least 2 examples (one can be a lucky&nbsp;guess)

7. What would the following code output in the&nbsp;console?

```
console.log( "0 || 1 = " + (0 || 1 ));
console.log( "1 || 2 = " + (1 || 2 ));
console.log( " 0 && 1 = " + ( 0 && 1 ));
```

Pretty obvious… I am including it because it didn’t had the usual “_please explain why_”. If it had it, I would probably writeâ€Š–â€Š1, 1, 0, because that is how || and &&&nbsp;work.

8. What will the following output in the&nbsp;console:

```
console.log((function f(n){return ((n > 1) ? n * f(n-1) : n)})(10));
```

_Answer:_ It is pretty obvious function with recursion that calls itself with a simple ternary â†’ 10 \* 9 \* 8 \* 7 \* 6 \* 5 \*4 \*3 \* 2&nbsp;\*1

I was honestly getting bored at this&nbsp;point.

9. Make a function â€˜sum’ that returns a sum of two values.  
this function should be called as these examples:  
console.log( sum( 5, 3 )); //returns 8  
console.log( sum(5)(3));// returns&nbsp;8

Yupee!!! A challenge has come before us! This is awesome! Especially after 8 generic JavaScript questions that people should be able to answer even if they are half brain&nbsp;dead.

Unfortunately it is both a challenge and it is&nbsp;not.

At first glance it is intimidating and it is weird, and I quite actually like it. Unfortunately I have recently read on Medium several articles about [currying](https://en.wikipedia.org/wiki/Currying) written by [Joel Thomas](https://hackernoon.com/@joelthoms). They can be seen as a working use here in “[Challenge: Program without variables #javascript](https://hackernoon.com/challenge-program-without-variables-javascript-bee89a41455e)” and as an explanations here in “[Currying in JavaScript ES6](https://blog.benestudio.co/currying-in-javascript-es6-540d2ad09400)”. So the question itself wasn’t very challenging. Of course there are very few people that I know, that are familiar with currying and I know even fewer (0) that have actually used it. Joel Thomas examples and description are tremendously useful and you should read&nbsp;them.

10. What is “callback hell” and how can it be avoided?  
_Answer:_ there is a whole website[callbackhell.com](http://callbackhell.com/) dedicated to this term. To put it in layman’s terms it is when developers write in JavaScript and create a bunch of functions that are triggered by one callback after another. This creates a pretty difficult environment to test and debug the product. If you want to fix it you can do the following things:  
 Keep your code shallowâ€Š–â€Šmeaning, keep it small and clean(KISS)  
 Modularize  
 Handle every single errorâ€Š–â€Šthere is a concept in Node.js called the error first callback. You can read more about it [here](http://fredkschott.com/post/2014/03/understanding-error-first-callbacks-in-node-js/). This will be mentioned later on as&nbsp;well.

#### Questions about Node.js &&nbsp;Gulp

Those somehow manage to be even more generic. I don’t know&nbsp;how.

1. What is Gulp?  
_Anwer: (copied from their webpage)â€Š_–â€Šgulp is a toolkit for automating painful or time-consuming tasks in your development workflow, so you can stop messing around and build something.  
_Personal answer:_ I have mainly seen it use as a build&nbsp;base.
2. Is Gulp base on node.js?  
_Answer:_ I actually wasn’t quite sure. Is there Gulp in Node.jsâ€Š–â€ŠYes. Is there Gulp in other environmentsâ€Š–â€ŠYes. According to their websiteâ€Š–â€ŠIntegrations are built into all major IDEs and people are using gulp with PHP,&nbsp;.NET, Node.js, Java, and other platforms. I will, however, be forced to say yes, because the people that made Gulp explain it asâ€Š–â€ŠUse npm modules to do anything you want + over 2000 curated plugins for streaming file transformations. I haven’t actually seen it used for anything JS as&nbsp;well.
3. What are modules in&nbsp;Node.js?
4. What is the purpose of the packaje.json file? (Yes, they have written it with a typo like&nbsp;that)
5. Explain npm in Node.js  
I will answer the above three as the same question, since they are.  
_First of all what are modules in Node?â€Š_–â€Šthey are basically the way libraries, “classes” and so on are represented in Node. Some articles for the topicâ€Š–â€Š[w3schools](https://www.w3schools.com/nodejs/nodejs_modules.asp). They (modules) can be written as AMD components and CommonJS components. Amd according to [wikipedia](https://en.wikipedia.org/wiki/Asynchronous_module_definition). Amd and CommonJS modules comparison from [RequireJS](http://requirejs.org/) can be found in a few sections [here](http://requirejs.org/docs/whyamd.html).  
_Secondly the packaGe.json fileâ€Š_–â€Šits documentation can be found [here](https://docs.npmjs.com/files/package.json). Roughly, the package.json allows you to specify which libraries a project needs, which libraries versions the project needs and it makes your build/install easily reproducable.  
_As for what npm is_, the abbreviation stands for Nodule Package Manager. Is it self explanatory? I believe it is. It is the thing that allows you to publish and use external libraries, update them, save them and manage them for a given project. if you use Node you should take look at the npm list of commandsâ€Š–â€Š **install** , **uninstall** , **update** , **ls** and its flagsâ€Š–â€Š-g,â€Š–â€Šsave, and so on. The npm docs can be found [here](https://docs.npmjs.com/) however the difference between global install or install withâ€Š–â€Šsave can be found and memorized mainly trough using&nbsp;it.
6. What is error-first callback?  
_Answer:_ I have mentioned it across the callbackhell earlier. It basically means put the error as the first argument of the function, success&nbsp;second.

#### Questions about TypeScript

1. How Do You Implement Inheritance in TypeScript?  
_Answer:_ using the extend keyword. TypeScript has it, [JavaScript does as&nbsp;well](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes/extends).
2. How to Call Base Class Constructor from Child Class in TypeScript?  
_Answer:_ super() or super( arghs&nbsp;)
3. What are Modules in TypeScript?  
Are you bored? I am. The questions are generic and are seen throughout similar articles and questions in StackOverflow and etc.  
_Anwer:_ A somehow thorough description can be found [here](https://blog.oio.de/2014/01/31/an-introduction-to-typescript-module-system/). Roughlyâ€Š–â€Šthey (the modules) are an extended version of the node ones. You can use external and internal modules, effectively creating namespaces.
4. Which Object Oriented Terms are Supported by TypeScript?  
_Answer:_ Read it likeâ€Š–â€Šwhat OOP keywords and principles does TypeScript has that JavaScript does not? (classes, interfaces, extending, types, public/private/protected variables) Of course all of those things can be emulated in JS by using [object.defineProperty()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperty) _(of which I am a huge fan),_ [js&nbsp;.extend](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes/extends), jQuery or Zepto [extend](https://api.jquery.com/jquery.extend/) and [fn.extend](https://api.jquery.com/jquery.fn.extend/).
5. What is tsconfig.json file?  
_Answer:_ Read it asâ€Š–â€Šhave you ever used TypeScript? If not here is your summaryâ€Š–â€ŠThe presence of a **tsconfig**. **json file** in a directory indicates that the directory is the root of a TypeScript project. The **tsconfig**. **json** file specifies the rootfiles and the compiler options required to compile the&nbsp;project.

### Summary

That was it. I realize that there are several articles out there, Medium included, that discuss JS related questions for job interviews. I just decided to share my own recent experience, which is a bit different, since it is from the perspective of both a guy that had interviewed developers and that has been just interviewed as a developer himself.

All of those questions are generic to the point that the whole test took me roughly 20 minutes (reading and writing, by hand on a piece of paper included). If you ask me, I would strongly recommend that companies and TLs and tech guys take those kind of tests, smash them and throw them not in the nearest garbage can, but the one a few blocks away, so there is no chance for someone to see them and connect them to their authors. Putting your company header on the top of each page isn’t necessary as&nbsp;well…

Don’t get me wrong, you can use this test to get someone’s understating tested. But it is in a very narrow way and the questions being generic enough, that I have seen literally 80% of the questions in the last week either on Medium, StakOverflow or another forum, means that someone can answer them quickly without actually understanding them.

So, instead I would prefer to be both interviewed by, and to interview an actual human being, instead of doing a test or read a test. It is a lot easier to talk with someone and ask him some of those questions, followed by clarifying follow up questions which you can use to test if someone actually knows what he or she talks about or he or she has just memorized it after reading it a gazillion times. It is also a nice way to find a person that has gotten an answer wrong because of some pitfall, but is a good enough developer to learn it in the future and the only reason he or she hasn’t answered correctly on the first try is because they haven’t actually used it. You can also see how the people you interview think when you ask them those questions yourself and discuss the questions with them. Even if their answer is wrong, cause by something, if their thought process is correct I am willing to give them a shot and help them&nbsp;out.

Most of those questions fall into two categoriesâ€Š–â€Šyou have either come across it and it was a painful enough experience to remember it (because it seemed really illogical and strange at the time or just because you weren’t familiar with JS well enough at the time (0.1 + 0.2 = 0.300000004 being a pretty good example of JS weirdness, or the fact that NaN is a number)) or things that are abstract enough that you have not yet encounter. Both of those categories can be memorized for tests. Memorizing them for tests does not mean an understanding of JavaScript ant does not mean the person can apply them correctly in his work. Which is again why I prefer human to human interaction or making a project/task and discussing it, instead of writing answers on a piece of paper, that is rated a week&nbsp;after.

By the wayâ€Š–â€Šthe test discussed above didn’t discussed any design patterns or anything more deep than understanding basic principles of the language which in my opinion is a bit strange, considering the fact that it was designed for senior developers.

This is just my opinion of course. If anyone thinks otherwise on anything I have said/written or any of my answers or explanations seem incorrect in any way I am open for discussion in the comments&nbsp;:)

I hope this was useful for anyone or at least made anyone think about those&nbsp;things.

And I really hope that some TL, instead of inviting them, giving them a couple sheets of paper, leaving them in a conference room (in which you can open, laptop, computer or phone and just copy answers and don’t think about it. I actually know people that have passed tests like that and have gotten decent jobs because of it) will start making interviews with people and actually talk with them to see how well they are quipped to be able to work in the&nbsp;team.

* * *