The ECMA standard dictates that a compliant implementation will detect and alert on all errors in the code even if the error is in a section of code that is not executed. Such dead code might be in a conditional block for which the condition could never be true. Nevertheless, a compile time warning should be generated.
This means that you should not rely on placing code within an if(false) block to prevent its execution. Instead, you should comment out the code to achieve the same effect.
This behavior is generally implementation-dependent due to the different ways that compilers and interpreters may be designed and built. It also changes as browser versions evolve and of course the kind of error that is thrown can also affect when and how it is detected and managed.
See also: | Diagnostic message, Error handler, Mathematics |
Prev | Home | Next |
Equality operator | Up | Error events |
JavaScript Programmer's Reference, Cliff Wootton Wrox Press (www.wrox.com) Join the Wrox JavaScript forum at p2p.wrox.com Please report problems to support@wrox.com © 2001 Wrox Press. All Rights Reserved. Terms and conditions. |