I want to intercept and log a statement, everytime a variable or property is declared
As an example after I following code:
let name = "John";
let greet = function(personName) {
let greeting = 'hello';
return greeting + ' ' + personName;
}
greet(name);
I should get following log:
name was created in window scope
greet was created in window scope
personName was created in greet scope
greeting was created in greet scope
Is this possible in javascript?