Recently the head is a little dizzy, in JavaScript write If-else If-else code, actually to else added conditions. The code is as follows:
<script>var i=10;if (i<=10) { alert (111);} Else (i>10) { alert (222);} </script>
IE9 and Chrome under the execution of this script, found not to prompt the JS error, the program's execution result is: The first popup 111 dialog box, after the Popup 222 dialog box. That is to say, if and else these 2 branches will execute, this traditional C/java difference is very big. The project I wrote with this similar brain code, the results for a long time did not see the problem. JavaScript as an interpreted language, syntax requirements and compiler hints are not as strict as java/c. When writing JavaScript, be careful and prescriptive, or you may find yourself in a very strange situation.
Why do the above JavaScript code work? Not clear, welcome the Great god explanation, the guidance.
The strange If-else if-else in JavaScript