Please consider two pieces of code (the first fingerprints are “Local eval”, the second is “Global eval”):
(function f() { var x; try { eval("x"); console.log('Local eval'); } catch (e) { console.log('Global eval'); } }())
and
var globalEval = eval; (function f() { var x; try { globalEval("x"); console.log('Local eval'); } catch (e) { console.log('Global eval'); } }())
It turns out that although globalEval === eval
evaluates to true
, globalEval
and eval
behave differently because they have different names. (An eval can only be local if it is spelled accurately by eval
.)
How can I distinguish from two ratings? Is there a way to extract variable labels for output behavior?
source share