JS Switch Judgment 3 Machine Operations While and Property Operation Code

Sennament:, such as VAR A = 10;

VAR B = 12; C = a> B? A: B;
  If an execution A is established, B  

var ishide = true;

  If the IF judgment statement is as follows  

IF (iSHIDE) {box.style.display = “block”;} else {box.style.display = “none”;}

three-mean operation alternative IF
   
Box.Style .display = ishide? “block”: “none”;

Decision condition? Establish an execution statement: Does not establish a statement.
The result is returned: the result of the establishment of
  Condition is not established: the result of the execution  
Simplified version of IF judgment

CONTINUE Skip this loop: cannot be written to three-go operation

for (var i = 0; i

BREAK: Terminate the entire loop; the default will only terminate this loop next to this loop if you want to terminate other cycles, you need to get a name to the loop.

Example:
  <5;i++){
if(i==3)
continue;跳过i=3这个循环不执行;其他依然执行。
} for (var i = 0; i 

Object storage data is in the properties of the object:

Object is a complex type of data, in the object we can store any type of data
first: Attribute Operation 1 A set of variables in a set of words when the first attribute is operated, and the variable cannot be used.
 Read Operation OBJ. Property Name  <5;i++){
if(i==3)
break;当循环执行到i=3时终止整个循环。
}
name:for(var i=0;i<5;i++){
for(var j=0;j<5;j++){
break name //终止两个循环
}
} Write Obj. Property Name = Attribute Value; 
obj.key = VAL; key value pair;

Such as

VAR OBJ = {}; obj.name = “leo”; this way of writing is written for the first attribute name, if you want to call, you must be like Obj .age., console.log (obj.name) ;. Obj.gender = “female”; console.log (obj.w); // Note that the first property operation is a value written, and the variable obj.w should not be used to find OBJ’s W attributes.

The second property operates the second attribute operation, and the receiving is a string, and the string can exist in variables, and can directly write OBJ [variable call]

Read Operation OBJ [“Properties Name]

OBJ [” Properties Name “] = attribute value;

  OBJ [" key "] = val;  
Note the second
, such as

var obj = { }; obj [‘name’] = “leo”; obj [‘agn’] = 40; obj [‘gene’] = “female”; obj [‘width’] = “180px”; OBJ [‘height’] = “180px”; OBJ [‘Children ‘] = [Daming “,” Xiao Ming “,” Sanming “]; var w =” width “; console.log (Obj [w]); // Second property operation, accept a string, The string can exist in variables, you can write OBJ [Variable Call] directly (“Name” in obj); // OBJ has a name property back TRUE, otherwise returns false

  Is there any this attribute in the object  
Returns TRUE or FALSE

for (VAR S IN OBJ) {Find all attributes s of OBJ The attribute name // of the Arr will become an in method to turn the cyclic variable S into an OBJ pair Console.log (S, OBJ [S]); the attribute name. If you want to use only the second middle name. The type of S is a string. } S is the attribute name of the attribute name OBJ [S] as the corresponding attribute name.

 for IN can be used to cycle objects and arrays cannot be used to loop a set of elements,   FOR cycle can only be used to cycle array (one Group elements) cannot be used to loop a set of objects. 
### WHILE statement ### Start value while (judgment condition) {execution statement; self-increment;} ## switch ## switch Judgment content) {case: Judgment content; // After the condition is established, execute the statement all the code under CASE, only the BREAK will end the execution statement; if you do not meet Break, you will meet all the code. Break; default: // All the above judgment is not established}

 Switch (A) {Case 10: // When a == 10; console.logo (";;;;") The statement is added after the end, add BreakBreak; // When A == 10 Case 15: // When A == 15; Console .logo ("ppppp") Break; default: // All judgment is not established}   Summary 
The above is Xiaobian to everyone The JS Switch judges the three-mean operation while and attribute operation code. I hope that everyone will help, if you have any questions, please send me a message, the small package will reply to everyone!

© Copyright Notice
THE END
Just support it if you like
like0
share
comment Grab the couch

Please log in to comment