HackerTrans
TopNewTrendsCommentsPastAskShowJobs

desert_boi

no profile record

comments

desert_boi
·7 ปีที่แล้ว·discuss
Interestingly when I was encountering this myself recently, I discovered that JS finally blocks can return after a function has nominally already returned. Consider the following closure.

    (() => {
      try {
        // finally will return prior to this console.log
        console.log('this try was executed and the return ignored')
        return 'try block'
      } catch (e) {
        return 'error block'
      } finally {
        return 'finally block'
      }  
    })()