Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Because JavaScript is such a small language, yet with incredible complexity, you should be able to ask relatively basic questions and find out if they are really that good based on their answers. For instance, my standard first question to gauge the rest of the interview is:</p> <blockquote> <p>In JavaScript, what is the difference between <code>var x = 1</code> and <code>x = 1</code>? Answer in as much or as little detail as you feel comfortable.</p> </blockquote> <p>Novice JS programmers <em>might</em> have a basic answer about locals vs globals. Intermediate JS guys should definitely have that answer, and should probably mention function-level scope. Anyone calling themselves an "advanced" JS programmer should be prepared to talk about locals, implied globals, the <code>window</code> object, function-scope, declaration hoisting, and scope chains. Furthermore, I'd love to hear about <code>[[DontDelete]]</code>, hoisting precedence (parameters vs <code>var</code> vs <code>function</code>), and <code>undefined</code>.</p> <p>Another good question is to ask them to write a <code>sum()</code> function that accepts any number of arguments, and returns their sum. Then, ask them to use that function (without modification) to sum all the values in an array. They should write a function that looks like this:</p> <pre><code>function sum() { var i, l, result = 0; for (i = 0, l = arguments.length; i &lt; l; i++) { result += arguments[i]; } return result; } sum(1,2,3); // 6 </code></pre> <p>And they should invoke it on your array like this (context for <code>apply</code> can be whatever, I usually use <code>null</code> in that case):</p> <pre><code>var data = [1,2,3]; sum.apply(null, data); // 6 </code></pre> <p>If they've got those answers, they probably know their JavaScript. You should then proceed to asking them about non-JS specific stuff like testing, workflows, version control, etc. to find out if they're a good <em>programmer</em>.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload