MCPcopy
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

1function foo() {
2 let x = (y = 0); // ⚠️ y becomes a global variable
3 x++;
4 y++;
5 return x;
6}
7
8console.log(foo(), typeof x, typeof y);
9// Output: 1, "undefined", "number"

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected