The code below will get different in Browser and Node.js.
Result of browser is a
.
Result of Node.js is b
.
if (1) {
function foo() { return 'a'; }
} else {
function foo() { return 'b'; }
}
console.log(foo());
Although this code style is anti-pattern, the code still can be run in environment.
How to explain it?
FYI.
Node.js environment Link: https://repl.it/CgWh
Native Browser environment Link: https://repl.it/CgWj
These links maybe not permanent.