The code in the finally clause must execute.
Here's the thread:
So, after increasing the value of i to 1 in the try block, it encounters a return statement. But finally, it is also blocked. Thus, it executes the final block and them again, it increases the value of i to 2 . Then the gap opens and the cycle ends.
So, the value i = 2 at the end. Hope the stream is transparent.
Javascript is GOD
source share