3 ms·
That’s possible. In reality, if I ever came across that piece of code and had a bug to fix in it, the first thing I’d do is rename a and b in one scope or the o
by ornornor 5y ago
That’s possible. In reality, if I ever came across that piece of code and had a bug to fix in it, the first thing I’d do is rename a and b in one scope or the other because it’s just asking for trouble otherwise and it’s not easy to understand what happens to a and b. That’s why I think using this question as a trivia question is bad. But the discussion we’re having about it clearly shows we both know what to look out for, that we’re competent, and is way more interesting than running JS code in our heads. Even if either of us gets the answer wrong, it doesn’t really matter as much as how we got there in my opinion.