//const myGlobal = 10; let isMyGlobalDefined = false; try { myGlobal; isMyGlobalDefined = true; } catch(err) { } println(`is myGlobal defined: ${isMyGlobalDefined}`);
const myGlobal = 10; const myGlobal = 10; console.log(myGlobal);
const myGlobal = 10; try { myGlobal; } catch(err) { globalThis['myGlobal'] = 10; } console.log(myGlobal);
function myFunction() { return 'Hello from myFunction'; } try { myFunction; } catch(err) { globalThis['myFunction'] = function() { return 'Hello from myFunction (from catch block)'; }; } println(myFunction());