Created
August 23, 2017 22:10
-
-
Save ahmehri/fa4273d4a16ed2ad8cd99c90bceb5fe6 to your computer and use it in GitHub Desktop.
Default function context when using/not using 'use strict'
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function f1WithoutUseStrict() { | |
return this; | |
} | |
function f1WithUseStrict() { | |
'use strict'; | |
return this; | |
} | |
console.log(f1WithoutUseStrict()); // node global object or window | |
console.log(f1WithUseStrict()); // undefined |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment