Skip to content

Instantly share code, notes, and snippets.

@Constellation
Created March 10, 2012 08:18
Show Gist options
  • Save Constellation/2010815 to your computer and use it in GitHub Desktop.
Save Constellation/2010815 to your computer and use it in GitHub Desktop.
// strict check
//
// append below snippet
//
// var isStrict = false
// try { Object.freeze({}).v = true; } catch (e) { isStrict = true; }
//
function strict() {
'use strict';
var isStrict = false;
try {
Object.freeze({}).v = true;
} catch (e) {
isStrict = true;
}
console.log(isStrict);
}
function nonStrict() {
var isStrict = false;
try {
Object.freeze({}).v = true;
} catch (e) {
isStrict = true;
}
console.log(isStrict);
}
strict();
nonStrict();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment