Top of JS Topics mostly failed by developers
How often do you ask yourself while coding: «What kind of magic is going on here?»
Some time ago we created a telegram channel with JS quizzes. Today we’d like to share statistics on what JS aspects are the most hardest for developers based on the failed answers percents.
First of all, we have to say what those quizzes are.
The quizzes we post cover the JS basics but not in a simple way. To answer correctly a respondent has to have a deep JS knowledge and understand how an engine interprets the instructions.
For example, every developer knows how to declare a variable in JS. One of the special words has to be used: var, let or const.
Many developers know how this instruction will be handled by the engine. It divides this instruction into two ones:
Variable declaration (the first line) is moved by the engine on the top of their scope before script running. And variable initialisation (the second line) is handled just in time the engine is on that line of the code.
But how many developers know how the engine interprets the following piece of code?
To answer correctly a developer has to know how the engine handles the multi declarations of the same variable name and which has more priority: variable declaration or function declaration?
This question is also about variable declaration, but does not look so easy.
Do you know the result? Try yourself. (Please don’t be embarrassed by the Russian language in the question — all you need is to choose the correct answer)
When we explain how exactly that piece of code is processed, 94% of respondents admitted that they didn’t know it works that way (ah, numbers are a stubborn thing!)
The calculation principle is simple — we divided all quizzes by topic (15 topics in total) and calculated the average percentage in each topic.
There is one inaccuracy in our approach, which is unlikely to have a significant impact on the result. To solve some of the quizzes, the developer must understand several topics, and in case of an incorrect answer, it is not known which one of them led to it. Such quizzes are placed in several categories at once.
Don’t think about the numbers below as constants. Everyday new developers are solving our quizzes and values are changing. However, our observations showed that regardless of the number of answers, the rating does not change much and the overall picture remains the same.
TOP-5: Variable Scope. 46% of correct answers.
For us this was the most fruitful topic, on which we easily came up with various challenges. To be honest, we didn’t expect the scope to take only the fifth place, as it seems more difficult to us. But the statistics know better.
An example of scope quiz:
TOP-4: Promises. 43% of correct answers.
Promises are a pretty straightforward tool to use. However, when a programmer needs to know how they work “from the inside” in order to answer a quiz, not many of them know the answer.
For example to answer the following quiz you need to know the algorithm of Promise’s state changing:
If you want to dive deeper in how Promises work under the hood, read this article:
Deep deep deep into Promises
You probably know how to use Promises, but do you know how they actually work?
TOP-3: Hoisting. 34% of correct answers.
So ,with a deep understanding of hosting, you can get very close to the language you’re actually working with.
One of many examples of hoisting:
TOP-2: ES6 modules. 32% of correct answers.
Can we change an imported variable so that the change is applied in the source module? Will an imported variable change if it is changed asynchronously after being exported? Our statistics show that only 32% of developers in avarage know the answers to these and other questions about modules.
This article will help you understand all the nuances of ES6 modules (you have no idea how many of them) and become a pro in this complex topic:
50 shades of ES6 modules
TOP-1: “this” variable. An execution context. 30% of correct answers.
We have a winner! Are you surprised? We are not! Our 12 years of experience of interviewing the JS engineers tell us the same. Understanding of “this” has always been the most difficult challenge for developers. And this is one of the reasons why React.js migrated from OOP to functional programming.
If you are one of the developers feeling confused about an execution context, do not give up, you just need a little more practice.
This TOP of “failures” only includes topics that can be classified. Besides them we post quizzes covering more specific JS features. Next time we’ll share TOP most failed quizzes among all topics, subscribe to not miss.
Subscribe to the telegram-channel to become the “know-it-all” person in the office. Follow us on LinkedIn for other cool projects we do.
What is the most difficult thing about JS for you? Share in the comments.