In the following code:
const is_strict = (function() { return this === undefined});
console.log(is_strict());
{
"use strict";
console.log(is_strict());
}
// false false
It seems the this
is always going to be within the context of where it is evaluated. Is there a way to make a single function such that it tells us whether the place where that function is invoked it is in strict mode or not? Or would it be required to inline the entire function each time:
(function() { return this === undefined})()