Interview Qs for JavaScript Developers

There’s good news and bad news for JavaScript developers. First, the good news: It’s fairly easy to master the basics of the popular programming language, and there are opportunities for professionals with varying skill levels.

Interview QsBut there’s also some bad news: Many jobs require developers to perform the same tasks over and over again, preventing them from gaining a deeper understanding of JavaScript, said Kyle Simpson, an open-Web evangelist from Austin, Texas and author of the book series You Don’t Know JS.

As a result, he added, undertrained developers may find themselves at a loss when an employer asks them to utilize less common aspects of JavaScript.

Check out the latest JavaScript-related jobs.

Where do you rank on the JavaScript aptitude scale? Simpson shared four interview questions that are designed to separate the novices from the experts:

What’s the difference between static and dynamic scoping? And how do those differences impact the development process and tool selection?

  • What Most People Say: “I can hide variables within an anonymous JavaScript function.”
  • What You Should Say: “Static scoping is based on the lexical scope model, and relies on variable declarations and function closures. Static scoping is fixed at the time you write the code, and can usually be optimized by the JS engine. Dynamic scoping with the ‘this’ keyword is based on run-time conditions. It may be less performance-optimized, but the flexibility of sharing the function across different contexts can be useful. Sometimes the predictability of static scoping is more preferable, and sometimes the flexibility of ‘this’ scoping is more what you want.”
  • Why You Should Say It: Being able to explain how a language works shows that you’re an experienced developer who possesses in-depth knowledge of a tool. The lexical scoping model and the dynamic ‘this’ model are at the very heart of JS, and any good JS developer knows how to navigate both mechanisms and properly make the tradeoffs.

What is function closure? What are some ways that closure can be used to maintain state?

  • What Most People Say: “Closure is about callbacks. Setting a timeout is an example of closure.”
  • What You Should Say: “Closure is how a function is able to remember the variables in its enclosing scope when it runs later in a different scope. For example, when I pass a function to an event handler or Ajax call, and its surrounding variables later when the event fires to remember its context. That’s an example of the function closure maintaining state.”
  • Why You Should Say It: Closure describes how a function maintains access to the scope of surrounding variables. It is one of the most foundational aspects of the language, and is used in many different contexts, including functional programming.

So, what role does closure play in functional programming?

  • What Most People Say: “Functional programming is about breaking up your program into many functions.”
  • What You Should Say: “Functional programming relies on closure to maintain state instead of side effects on surrounding variables. This lets you perform operations on values in a more predictable way.”
  • Why You Should Say It: Closure is one of the building blocks of functional programming, and JS’s ability to mix procedural and OO concepts with the power of functional programming is its most unique and important language design characteristic. This powerful combination gives developers many more tools to solve problems.

In your opinion, what’s the difference between easy and simple software and why does it matter?

  • What Most People Say: “I prefer to make easy software because I want other developers and users to work faster and create more code in less time.”
  • What You Should Say: “Simple software is modular. And subdividing a computer program into separate sub-programs makes it easier to develop, test and maintain code. Simple doesn’t necessarily mean faster, however. Simple software makes it easier to write great code but it’s not always faster.”
  • Why You Should Say It: There’s a subtle but massive difference between easy and simple software, and of course, modern JavaScript allows developers to write modularized code.

Post a Comment

Your email address will not be published.