Skip to content

Instantly share code, notes, and snippets.

@ahmehri
Created August 23, 2017 22:10
Show Gist options
  • Save ahmehri/fa4273d4a16ed2ad8cd99c90bceb5fe6 to your computer and use it in GitHub Desktop.
Save ahmehri/fa4273d4a16ed2ad8cd99c90bceb5fe6 to your computer and use it in GitHub Desktop.
Default function context when using/not using 'use strict'
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