joelanman, This feels a bit wonky to me. You can't use const like this:
try { const myVar = myFunc(options) } catch (error) { console.error(error) } console.log(myVar)
as myVar doesn't exist outside the try scope. So if you need to do a try catch, you have to use
let
- even if you actually want to use the variable as a const (not change it later)let myVar try { myVar = myFunc(options) } catch (error) { console.error(error) } console.log(myVar)
Add comment