<script>
/* Can you see the number of the following program alert at a glance?
*/
if (false)
if (true)
if (true)
alert ("1");
Alert ("2");
Alert ("3");
* *
This is not a clear point to write.
*/
if (false)
if (true)
if (true)
alert ("1");
Alert ("2");
Alert ("3");
/*
This is more clear, but not feel too ..., what good way.
*/
if (false) {
if (true) {
if (true) {
alert ("1")
;
}}} Alert ("2");
Alert ("3");
/*
as soon as possible, if the code in the Fucntion, you can use return
if it is to support the syntax of the label, you can directly goto exit to enhance readability
/if (false) returns;
if (!true) return;
if (true) {
alert (' 1 ');
}
Alert ("2");
Alert ("3");
/*
Summary:
1, if statement is best to use {} and progressive aspects of the separation of logic to enhance readability
2, return results as soon as possible to reduce the progressive level, enhance readability/
</script>