Code
Hub
Workspaces
Connect
Indexed graphs
Engine
MCP
copy
hub
/
github.com/sudheerj/javascript-interview-questions
/ foo
Function
foo
coding-exercise/accidental-global.js:1–6 ·
view source on GitHub ↗
()
Source
from the content-addressed store, hash-verified
1
function
foo() {
2
let
x = (y = 0);
// ⚠️ y becomes a global variable
3
x++;
4
y++;
5
return
x;
6
}
7
8
console.log(foo(), typeof x, typeof y);
9
// Output: 1, "undefined", "number"
Callers
1
accidental-global.js
File · 0.70
Calls
no outgoing calls
Tested by
no test coverage detected