JSFiddle - React, Tailwind, and code Playground
JavaScript
const env = new Proxy({}, {
has() { return true },
get: function (target, name){
console.log(`get for target: `, target, name);
if (name === 'console') return console
return 'tacos';
}
});
with (env) {
console.log(`document with proxy: `, document);
console.log(`access random property: `, a);
}