by Xavi · 15y ago · 0 comments
Can the interviewee code: https://gist.github.com/633341
Can the interviewee read/debug code: https://gist.github.com/633087
I used these questions during a couple of interviews. They seemed to work well.
I don't think many entry level programmers will think about returning a function to implement say, but I can be wrong.
function say(arg) {
return function(word) {
alert(arg + " " + word);
};
}
It solves "hello world", but wouldn't work for something like say("dogs")("and")("cats"). Are you expecting an arbitrary number of function returns?I would be blown a way if someone came up with solution that could handle arbitrary function returns. My friend actually wrote an interesting article on the subject. Here's the link if you're interested: http://msdn.microsoft.com/en-US/scriptjunkie/gg575560.aspx
function say(x)
{
return function (y) { alert( capitalize(x) + " " + capitalize(y)); }
}
Where capitalize makes the first character uppercase.