code-to-graph icon indicating copy to clipboard operation
code-to-graph copied to clipboard

Detect unreachable code

Open juanjoDiaz opened this issue 6 years ago • 0 comments

const myFunction = (x) => {
  if(x>0){
    return "ok"
  } else {
    throw "not ok"
  }

  if(x>0){
    return "ok"
  } else {
    throw "not ok"
  }
}

The second if is unreachable so it will never be executed and it shouldn't be printed or be printed highlighting that it's unreachable.

juanjoDiaz avatar Jan 19 '19 14:01 juanjoDiaz