how use const in try catch block [duplicate]
You’ve hit the nail on the head, because of block scoping you can’t declare a const in a try catch block and use it outside the block. You have 2 3 options: Use let: let foo; try{ foo = bar[global.name].foofoo[global.name2]; }catch (err){ console.log(error(err.message)); } Or if there is very little code to come after the … Read more