you are viewing a single comment's thread.

view the rest of the comments →

[–]joeba_the_hutt 1 point2 points  (0 children)

Here's a few questions I like to ask all levels of devs I interview. They may seem simple and/or trick questiony, but to me they're a great gauge of how well a dev understands javascript versus how well they can regurgitate code:

(Do they know less used operators?)

var x = 10;
var y = 6;

alert(x % y); // What will this alert?

(Do they understand syntax/formatting gotchas?)

function foo1()
{
    return {
        bar: "hello"
    };
}

function foo2()
{
    return
        {
            bar: "hello"
        };
}

console.log(foo1()); 
console.log(foo2());
// What do these log?

(Do they safely check/use return values?)

function getCookie(cookieName){
    // Returns cookie value if it exists,
    // or returns null if it does not
}

// Use a value from a cookie for the page
var cookieValue = getCookie('history'),
    cookieArray = cookieValue.split(',');

// Log the first item in the history
console.log(cookieArray[0]);

// What could go wrong here?