8 JavaScript Interview Questions You Need to Know

Hiring manager Kevin Kubasik at marketing and web development agency HZDG has an insight assessment when it comes to hiring coders steeped in JavaScript knowledge.

Says Kubasik, HZDG’s development director: “[It’s] a language that almost every developer can use to accomplish little tasks, but very few developers really understand the scope of its power, or how to take advantage of everything it can do.”

Ferreting out the extent of a candidate’s knowledge about JavaScript comes down to asking some these common questions, say IT hiring managers:

Q: How do you implement an extend function that takes an object and extends itwith new properties and makes it work on n levels of recursion? Basically, duplicating a jQuery extend.

This question shows whether candidates have an understanding of basic programming concepts such as recursion, says Jonas Huckestein, co-founder of conference-calling startup HipDial.

Q: Can you write a function that takes an object and appends it to the DOM, making it so that events are buffered until the next tick? Explain why this is useful?

This last part only applies in browser-side settings where it can dramatically increase performance, he says.

Q: How do you write an event emitter base class that allows you to add event listeners?

This question can nicely lead into architectural questions, Huckestein says, such as: “How would you make an event emitter that’s distributed?”

Q: What is the concept of “functions as objects” and how does this affect variable scope?

New hires at Vector Media Group are asked this mid-level question, says Matt Weinberg, president of development and technology at Vector, a web development and Internet marketing agency in Manhattan.

“What it can suggest is that the person really ‘gets’ JavaScript and the way it works as opposed to just having copied syntax and code from the web without understanding it,” Weinberg says. “It can also show that the person has at least some understanding of basic programming concepts, which in my experience means they will be better equipped to come up with good solutions to hard problems.”

Q: What modern JavaScript frameworks and utilities excite you right now from an approach and code point of view, even if they’re not yet stable enough for client work?

“I’m less concerned with the actual answers, though there are some frameworks I’m very interested in,” Weinberg says. “[I’m] more concerned with knowing that they keep up to date on the latest thinking around JavaScript.”

Weinberg added: “When they explain what excites them about these frameworks or utilities, I can get a good sense of the kind of work and style they prefer.”

Kubasik is also concerned about the flood of “copy-and-paste” JavaScript solutions.

“jQuery and its plugin system are so popular that many developers only know JavaScript in that context, and have trouble understanding how to create new functionality,” Kubasik says. “While this is fine for many websites, which only need a dynamic menu or homepage carousel, as the emerging web becomes more “stateful” – (he points to USA Today’s redesign as an example of pages that users navigate without loading a new page) – this knowledge becomes crucial to developing robust and maintainable applications.”

Q: What is the difference between .call() and .apply()?

The JavaScript Function prototype has two very powerful functions that are at the core of Javascript’s “everything is an object” mentality, including functions, Kubasik says.

“The really important part of this discussion is not that they remember which is which, but more that the interviewee understands that the “this” keyword is not as predictable as in other languages, and that functions can be applied to other objects, and generally be treated as data,” he says.

Q: Can you explain how inheritance works in JavaScript?

JavaScript has a somewhat unique inheritance model and a good understanding of it is crucial to using JavasScript in larger applications, Kubasik says.  “We are looking for the applicant to discuss not only prototypes, and how that affects inheritance, but in what ways this can be more flexible than classical inheritance models seen in Java and C#.”

Q: What is event bubbling in the DOM?

The main goal of this question is to establish that the applicant knows what order events will be propagated in the DOM – most specific to least specific.

“Not everyone may know this by the name ‘event bubbling,’ so asking about event propagation in general is sometimes needed. Ideally, this is an opportunity to discuss event models outside of the DOM, and ask follow-up questions about routing based on user actions, looking for techniques popularized with frameworks like backbone.js, or AngularJS,” Kubasik says.

Blake Haggerty, Rackspace’s lead recruiter in San Francisco, says that beyond specific questions, recruiters have other resources for assessing candidates’ skills with JavaScript.

“I can go onto GitHub or BitBucket. I can actually look at what they’ve done with their code. I can see the projects they’ve worked on [and] I can see how much they’ve contributed to projects. I can go onto sites like Stack Overflow and see who are the influential people in the community, see who’s answering questions specifically about JavaScript,” he says. “… from that I already know they’re technically savvy, so from there, my role is just to convince them to leave where they currently are and come work for us.”

Comments

  1. BY Harvey Ramer says:

    Thank you for this. This helps me understand better the JavaScript skills that employers are seeking.

  2. BY svdb says:

    Only questions 4, 6, 7 and 8 are worthwhile.
    The rest are context base which makes them useless.

  3. BY O says:

    These questions are useless. You are not gone find a right person asking these questions which does not make any sense to a well verse developer because he is not interested to see what you are looking in to person. He is too busy about how he can use all the tools and tecnique to write a better programs. Also a well verse developer does not put his work on Hithub/Big Bucket or Stack Overflow because he is too busy working on his very well development. Also, stop looking out those places free places because some cheater can trick you by putting someone else’s codes there without a good developer knowing about it.

  4. BY john says:

    I agree with the last commenter. Asking obfuscated psychoanalysis questions for a job at a shitty start up doesn’t reflect well on your company.

  5. BY ken says:

    And the answers are? :-P

    I’d also say that frameworks take care of a lot of this for you…e.g., the extend function. We’re getting to the point that Javascript is maturing enough that being able to uses frameworks effectively is more important than these obscure questions…

  6. BY John says:

    Worthless questions. Hence why you would never want to work at the company mentioned in the article. Pointless interview not worth a good web devs time.

Post a Comment

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>