why use finally in try catch code example
Example 1: finally always after try catch
Finally block is ALWAYS executed AFTER try / catch Javascript blocks.
Example 2: try-catch-finally
localStorage.getItem(key)
try {
data = JSON.parse(key)
}
catch (e) {
// if the code errors, this bit of code will run
}
finally {
return data
}