Assume the following piece of code, which runs fine
var Loader = { // Can be 'const' as well
get db() {
throw('exception');
}
}
function test(){
console.log("I'm fine")
}
test()
And almost the same, with var omitted, which is also fine(in javascript)
Loader = { // Can be 'const' as well
get db() {
throw('exception');
}
}
function test(){
console.log("I'm fine")
}
test()
However, if second one is run inside Google Apps Script(assuming you run function test) it fails on exception, trying to execute throw('exception') from getter of 'db' property. Why is that?