Echo JS 0.11.0

<~>
MaxArt 2454 days ago. link 1 point
> The return statement ends function execution

That's not correct in some edge cases. Consider the following:

function foo() {
  try { 
    console.log("foo"); 
    return 0;
  } finally {
    console.log("bar");
  }
}

When executed, it will print both "foo" and "bar".

Also worth mentioning that a return statement inside the finally branch with override any previous one.

Replies