<script type="Text/javascript">vara,b,c,d; A= (b=5, c=2, d=3);//comma operator: it only returns the value of the last-side expressionConsole.log (a);//3 vara,b,c,d; A=void(b=3, c=2, d=3);//Void emphasizes that subsequent expressions do not return a value to aConsole.log (a);//undefined vara=[1,2]; Console.log (a instanceof Array);//A is an instance of the array trueConsole.log (a instanceof Object);//All objects are an instance of an object</script>
For (variable in object) {
The block of statements executed;
}
Role:
1. Iterate through all the array elements in the array.
2. Traverse all the properties of the JavaScript object.
<script type="Text/javascript">varArr=NewArray (5);//Although the length of the array is defined as 5, it is possible to assign values backwardsarr[0]=1; arr[2]=3; arr[3]="ABC"; arr[5]=true; for(varIndexincharr) { /*Console.log (index);//0 2 3 5*/Console.log (Arr[index]);//1 3 ABC true } for(varPropertiesinchNavigator) {Console.log ("Properties:"+properties+", property value:"+navigator[properties]); }</script>
Exception Throw statement
<script type="Text/javascript"> for(varI=0;i<Ten; i++) {document.write (i+"</br>"); if(i==5){ Throw NewError ("an error.");//See the error effect on the console } } </script>
Exception Capture Statement
<script type= "Text/javascript" >try{var age=5;if (age==5) { throw new Error ("Too Young");}} catch (E) {document.write ("error:" +e.message);} Finally{document.write ("a finally block that is always executed");} </script>
With statement
<script type="text/javascript"> //withstatement with ( Document) { write (" output first row of data </br>"); Write (" output second row of data </br>"); Write (" output third row of data </br>"); } </script>
JavaScript Learning 1