== Why is this an issue?

Unreachable code is the code whose statements cannot be executed under any circumstances. Jump statements, like ``++return++``, ``++break++``, ``++continue++``, and ``++throw++``,  alter the normal flow of control within a program, making it possible to skip certain parts of the code, terminate loops prematurely, or exit from functions. So any statements that come after a jump are effectively unreachable.

Unreachable statements can be a sign of a logical error or oversight in the program's design, leading to unexpected behavior at runtime.

[source,javascript,diff-id=1,diff-type=noncompliant]
----
function func(a) {
  let i = 10;
  return i + a; 
  i++; // Noncompliant: this is never executed
}
----

Identify and remove unreachable statements from your code.

[source,javascript,diff-id=1,diff-type=compliant]
----
function func(a) {
  let i = 10;
  return i + a;
}
----

== Resources
=== Documentation

* MDN web docs - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/return[`return`]
* MDN web docs - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/break[`break`]
* MDN web docs - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/throw[`throw`]
* MDN web docs - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/continue[`continue`]
* MDN web docs - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Stmt_after_return[Warning: unreachable code after return statement]

ifdef::env-github,rspecator-view[]

'''
== Implementation Specification
(visible only on this page)

=== Message

Remove this code after the "[return|break|continue|goto|throw]" statement.


include::../highlighting.adoc[]

'''
== Comments And Links
(visible only on this page)

include::../comments-and-links.adoc[]

endif::env-github,rspecator-view[]
