How to write JavaScript logic control statements
Most people do not understand the knowledge points of this article "how to write JavaScript logic control sentences", so the editor summarizes the following contents, detailed content, clear steps, and has a certain reference value. I hope you can get something after reading this article. Let's take a look at this "how to write JavaScript logic control statements" article.
1. If conditional statement if (conditional) {/ / JavaScript code;} else {/ / JavaScript code;}
Null, "", undefined, NaN, false in If-- the result is false, except for true.
2. Switch multi-branch statement switch (expression) {case constant 1: JavaScript statement 1; break; case constant 2: JavaScript statement 2; break; default: JavaScript statement 3;} 3. For, while loop statement for (initialization; condition; increment) {JavaScript code;} while (condition) {JavaScript code For-invar fruit= ["apple", "orange", "peach", "banana"]; for (var i in fruit) {[xss_clean] (fruit [I] + ");}
I is the array subscript, and in array queries all array subscripts
The above is the content of this article on "how to write JavaScript logic control sentences". I believe we all have a certain understanding. I hope the content shared by the editor will be helpful to you. If you want to know more about the relevant knowledge, please pay attention to the industry information channel.