Skip to content

Instantly share code, notes, and snippets.

@1kohei1
Created January 12, 2019 17:19
Show Gist options
  • Save 1kohei1/eb2dff349d333942cd806e191fe1d83f to your computer and use it in GitHub Desktop.
Save 1kohei1/eb2dff349d333942cd806e191fe1d83f to your computer and use it in GitHub Desktop.
function foo() {
var undefined = 2;
console.log(undefined); // 2
}
foo();
// In strict mode, this is also valid
function foo() {
'use strict';
var undefined = 2;
console.log(undefined); // 2
}
foo();
// However, you cannot overwrite the global undefined
// At least in Google Chrome Console
var undefined = 2;
console.log(undefined); // undefined
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment