One, array
An array uses a separate variable name to store a series of values,
JavaScript provides an array with a length property to get the lengths of the arrays.
The JS array has the following features:
1. The array length is variable. The total length equals the maximum index value of the array +1
2. Element types in the same array can differ
3. when an unassigned array element is accessed, the element value is undefined and the array is not out of bounds
<script> var arr1=[2,5,6]; Assign a value to the array element var arr2=[] when defined; defines an empty array var arr3=new Array (); defines an empty array and assigns values by index arr3[0]=1; arr3[3]= "abc"; </script>
Array
Second, operator
+ +: self-added : +1 of the original data
--: self-subtraction : 1 of the original data
For example:
We look at the equation from left to right in the blending operation.
first in variable x The value of span class= ">x ( int y = 3 + ++x + x * 10), +1; Here the variable x = 3+1 = 4, ( If not understood can make int a = X + +, a = 3);
then go to the right to see ++x,+ + in front of the variable x , the first self +1 ( that is , x = 4+1 = 5), then the value is then placed in this position (int y = 3 + 5 + x *)
last x *, at which point x = 5, int y = 3 + 5 + 5 *;
The end result is x = 5;y = 58;
|
Type |
Operator |
|
Arithmetic operators |
+ - * / % ++ -- |
|
Assignment operators |
= |
|
Comparison operators |
> < >= <= = = = = = = = =!=== |
|
logical operators |
&& | | ! |
|
Bitwise operators |
& | ~ ^ << >> |
|
Other operators |
Trinocular operator (?:), comma operator, void operator, typeof, instanceof |
<!doctype html>//var a=52%10//document.write (a);//Take the remainder//var b=2;//var c=3;//B>c?alert ("established"): Alert ("not established");//Three mesh operator//var a,b,c,d;//a=void (b=5,c=2d=3);//alert (a);//void operator varA=[12]; Alert (typeof(a));//returns the data type of the variableAlert (AinstanceofArray); Alert (AinstanceofObject); </script>operatorJS Basics 4-Arrays and operators