I conduct interviews (not at Facebook), I don't ask questions about algorithms, but I wouldn't probably hire someone who writes code like that, especially if it's a mid-senior position, because there are too many bad practices:
var shouldn't be used anymore;
variables should have more descriptive names and start with a lowercase character;
always ===, never ==;
static constants should be defined outside functions;
renturn stack.length === 0 is cleaner.
I wrote the implementation below and I find it much cleaner.
I conduct interviews (not at Facebook), I don't ask questions about algorithms, but I wouldn't probably hire someone who writes code like that, especially if it's a mid-senior position, because there are too many bad practices:
var
shouldn't be used anymore;===
, never==
;renturn stack.length === 0
is cleaner.I wrote the implementation below and I find it much cleaner.