10 Interview Questions Every JavaScript Developer Should Know - JavaScript Scene - Medium
10 Interview Questions Every JavaScript Developer Should Know - JavaScript Scene - Medium
10 Interview Questions Every JavaScript Developer Should Know - JavaScript Scene - Medium
Eri c Elliott
Comp assionate entrepreneur on a mission to end homelessness. #jshomes Javascript, tech edu...
O ct 2, 2015 · 15 min read
10 Interview Questions
Should Know
AKA: The Keys to JavaScript Mastery
about it. They will go to their graves clutching to it. As Bruce Lee famously
said:
. . .
https://medium.com/javascript-scene/10-interview-questions-every-javascript-developer-should-know-6fa6bdf5ad95#.epqwyovct 1/19
8/1/2016 10 Interview Questions Every JavaScript Developer Should Know — JavaScript Scene — Medium
. . .
I’ve seen classes wreak havoc on projects, companies, and lives. Many
I ran an app consulting firm in the early days of SaaS, starting before the
term was coined. I have worked on hundreds of projects for both startups
I saw up close the many ways in which the class paradigm invited unwary
developers down the wrong road, and I saw the extremely costly effects. I’ve
Class in JS is not harmless sugar for prototypal OO. Class is a virus that
and at the same time, React was taking off. Lots of people started using
classes for React components (you don’t have to: the new React 0.14
Many are unaware that you can build React components in a class-free style.
During the days of Backbone dominance (Backbone used its own flavor of
classes that require `new`, and factories that don’t, forcing the use of
module tightly to the container API. Those of you with Angular experience
will understand what I’m talking about. Angular has four different ways to
https://medium.com/javascript-scene/10-interview-questions-every-javascript-developer-should-know-6fa6bdf5ad95#.epqwyovct 2/19
8/1/2016 10 Interview Questions Every JavaScript Developer Should Know — JavaScript Scene — Medium
them all.
Many brilliant people warned of the perils of class inheritance decades ago,
before JavaScript was invented. You can find their warnings in essays with
problems with class in what has become known as The Gorilla Banana
Problem from the great book, “Coders at Work” (buy it, there’s lots of other
“The problem with object-oriented languages is they’ve got all this implicit
environment that they carry around with them. You wanted a banana but
what you got was a gorilla holding the banana and the entire jungle.”
Object-Oriented Software” — the book from which design patterns get their
name — implores:
. . .
. . .
https://medium.com/javascript-scene/10-interview-questions-every-javascript-developer-should-know-6fa6bdf5ad95#.epqwyovct 3/19
8/1/2016 10 Interview Questions Every JavaScript Developer Should Know — JavaScript Scene — Medium
Edit:
Some readers are asking about the class rant. Learn more about why I don’t like
classes in JavaScript:
* The Two Pillars of JavaScript: How to Escape the 7th Circle of Hell
If you’re one of those obstinate classical inheritance fans, you may disagree
with lots of this article, but there are still some gems here for you, too. Take
. . .
. . .
. . .
https://medium.com/javascript-scene/10-interview-questions-every-javascript-developer-should-know-6fa6bdf5ad95#.epqwyovct 4/19
8/1/2016 10 Interview Questions Every JavaScript Developer Should Know — JavaScript Scene — Medium
Your early hires should be very strong, senior-level candidates. People who
can hire and mentor other developers, and help the mid-level and junior
Read “Why Hiring is So Hard in Tech” for a good breakdown of the general
. . .
. . .
Pair program with the candidate. Let the candidate drive. Watch and listen
more than you talk. A good project might be to pull tweets from the Twitter
That said, no single exercise will tell you everything you need to know. An
interview can be a very useful tool as well, but don’t waste time asking
about syntax or language quirks. You need to see the big picture. Ask about
architecture and paradigms — the big decisions that can have a major impact
https://medium.com/javascript-scene/10-interview-questions-every-javascript-developer-should-know-6fa6bdf5ad95#.epqwyovct 5/19
8/1/2016 10 Interview Questions Every JavaScript Developer Should Know — JavaScript Scene — Medium
Syntax and features are easy to Google. It’s much harder to Google for
Here are some questions that will help you explore the stuff that really
matters:
Good to hear:
Red flags:
programming.
Learn More:
functions and avoids shared state & mutable data. Lisp (specified in 1958)
was among the first languages to support functional programming, and was
heavily inspired by lambda calculus. Lisp and many Lisp family languages
JavaScript in ES5.
https://medium.com/javascript-scene/10-interview-questions-every-javascript-developer-should-know-6fa6bdf5ad95#.epqwyovct 6/19
8/1/2016 10 Interview Questions Every JavaScript Developer Should Know — JavaScript Scene — Medium
Good to hear:
• Avoid side-effects.
Red flags:
Learn More:
prototypal inheritance?
with the `new` keyword. Class inheritance may or may not use the `class`
Instances may be composed from many different objects, allowing for easy
selective inheritance.
. . .
https://medium.com/javascript-scene/10-interview-questions-every-javascript-developer-should-know-6fa6bdf5ad95#.epqwyovct 7/19
8/1/2016 10 Interview Questions Every JavaScript Developer Should Know — JavaScript Scene — Medium
. . .
Good to hear:
Red Flags:
inheritance.
Learn More:
object-oriented programming?
https://medium.com/javascript-scene/10-interview-questions-every-javascript-developer-should-know-6fa6bdf5ad95#.epqwyovct 8/19
8/1/2016 10 Interview Questions Every JavaScript Developer Should Know — JavaScript Scene — Medium
OOP Pros: It’s easy to understand the basic concept of objects and easy to
interpret the meaning of method calls. OOP tends to use an imperative style
OOP Cons: OOP Typically depends on shared state. Objects and behaviors
are typically tacked together on the same entity, which may be accessed at
competing for the same resources. With features such as the availability of
simplified and easily recomposed for more generally reusable code compared
to OOP.
FP also tends to favor declarative and denotational styles, which do not spell
to do, letting the underlying functions take care of the how. This leaves
allowing you to replace entire algorithms with more efficient ones with very
little code change. (e.g., memoize, or use lazy evaluation in place of eager
evaluation.)
Computation that makes use of pure functions is also easy to scale across
FP has a much steeper learning curve than OOP because the broad
popularity of OOP has allowed the language and learning materials of OOP
much more academic and formal. FP concepts are frequently written about
using idioms and notations from lambda calculus, algebras, and category
to be understood.
Good to hear:
https://medium.com/javascript-scene/10-interview-questions-every-javascript-developer-should-know-6fa6bdf5ad95#.epqwyovct 9/19
8/1/2016 10 Interview Questions Every JavaScript Developer Should Know — JavaScript Scene — Medium
maintainability.
curve.
in OOP.
Red flags:
the limitations.
Learn More:
This is a trick question. The answer is never. I’ve been issuing this challenge
for years, and the only answers I’ve ever heard fall into one of several
~ Douglas Crockford
Good to hear:
https://medium.com/javascript-scene/10-interview-questions-every-javascript-developer-should-know-6fa6bdf5ad95#.epqwyovct 10/19
8/1/2016 10 Interview Questions Every JavaScript Developer Should Know — JavaScript Scene — Medium
Red flags:
Learn More:
Each type of prototypal inheritance has its own set of use-cases, but all of
them are equally useful in their ability to enable composition, which creates
Good to hear:
an obvious solution.
Red flags:
https://medium.com/javascript-scene/10-interview-questions-every-javascript-developer-should-know-6fa6bdf5ad95#.epqwyovct 11/19
8/1/2016 10 Interview Questions Every JavaScript Developer Should Know — JavaScript Scene — Medium
Learn More:
mean?
relationships.
Good to hear:
• Avoid the gorilla banana problem (“what you wanted was a banana,
what you got was a gorilla holding the banana, and the entire jungle”).
Red Flags:
Learn More:
https://medium.com/javascript-scene/10-interview-questions-every-javascript-developer-should-know-6fa6bdf5ad95#.epqwyovct 12/19
8/1/2016 10 Interview Questions Every JavaScript Developer Should Know — JavaScript Scene — Medium
Intro ducing
th e Stamp Specification
Mov e Over, `class`:
Compos able Factory Functions Are Here
m edium.com
8. What are two-way data binding and one-way data ow, and
Two way data binding means that UI fields are bound to model data
dynamically such that when a UI field changes, the model data changes with
it and vice-versa.
One way data flow means that the model is the single source of truth.
Changes in the UI trigger messages that signal user intent to the model (or
“store” in React). Only the model has the access to change the app’s state.
The effect is that data always flows in a single direction, which makes it
easier to understand.
One way data flows are deterministic, whereas two-way binding can cause
Good to hear:
https://medium.com/javascript-scene/10-interview-questions-every-javascript-developer-should-know-6fa6bdf5ad95#.epqwyovct 13/19
8/1/2016 10 Interview Questions Every JavaScript Developer Should Know — JavaScript Scene — Medium
Red flags:
difference.
Learn more:
Introduction to React.js
architectures?
unit of code whose components are designed to work together, sharing the
space and scaling independently from each other across potentially many
separate machines.
https://medium.com/javascript-scene/10-interview-questions-every-javascript-developer-should-know-6fa6bdf5ad95#.epqwyovct 14/19
8/1/2016 10 Interview Questions Every JavaScript Developer Should Know — JavaScript Scene — Medium
logging, rate limiting, and security features such audit trails and DOS
protection.
When everything is running through the same app, it’s easy to hook up
Monolithic cons: Monolithic app services tend to get tightly coupled and
may be dependencies, side-effects, and magic which are not obvious when
organized, since each microservice has a very specific job, and is not
concerned with the jobs of other components. Decoupled services are also
(for example, serving both the web clients and public API).
organized because it’s possible to isolate hot services and scale them
you’re likely to discover lots of cross-cutting concerns that you did not
effort.
cutting concerns in another service layer that all traffic gets routed through.
architecture, it’s possible to delay the cost of that work until the project is
https://medium.com/javascript-scene/10-interview-questions-every-javascript-developer-should-know-6fa6bdf5ad95#.epqwyovct 15/19
8/1/2016 10 Interview Questions Every JavaScript Developer Should Know — JavaScript Scene — Medium
Good to hear:
that services are independent from each other at the code level, but
Red flags:
architectures.
in JavaScript?
When a blocking operation is needed, the request is started, and the code
keeps running without blocking for the result. When the response is ready,
control flow continues. In this way, a single program thread can handle
User interfaces are asynchronous by nature, and spend most of their time
waiting for user input to interrupt the event loop and trigger event handlers.
the same way, waiting in a loop for a network request, and accepting more
https://medium.com/javascript-scene/10-interview-questions-every-javascript-developer-should-know-6fa6bdf5ad95#.epqwyovct 16/19
8/1/2016 10 Interview Questions Every JavaScript Developer Should Know — JavaScript Scene — Medium
Good to hear:
implications.
Red flags:
Learn more:
. . .
Conclusion
https://medium.com/javascript-scene/10-interview-questions-every-javascript-developer-should-know-6fa6bdf5ad95#.epqwyovct 17/19
8/1/2016 10 Interview Questions Every JavaScript Developer Should Know — JavaScript Scene — Medium
That’s it for the interview. Stick to high-level topics. If they can answer these
experience to pick up language quirks & syntax in a few weeks, even if they
What you really need to know is, “does this candidate understand how to
. . .
. . .
and “Learn JavaScript Universal App Development with Node, ES6, & React”.
Fitness, The Wall Street Journal , ESPN, BBC, and top recording artists
He spends most of his time in the San Francisco Bay Area with the most
https://medium.com/javascript-scene/10-interview-questions-every-javascript-developer-should-know-6fa6bdf5ad95#.epqwyovct 18/19