variable var a=10; A=20; Note: The variable declaration is released after the browser is closed, and you can use the var variable name before closing=Value Note: JavaScript is a weakly typed language var a=10; statement a=10; Assignment data type typeof (variable); 1. Number (int float DoubleNote: The calculations are still separated by integers and floating point types.2, String (stringChar) 3.Boolean4, Object (obejct arrayNULL) Integer: var a=45; var a=045; var a=0xff; Floating point: Var f=10.5; var f=10.55; var f=10.5e+10; String:' "" +concatenate two string operators and expression arithmetic operators+ - * / % ++ --Note:+when any string is encountered, it becomes a string join assignment operator= + - += -= *= /= %=Conditional Operators> < = = = = = =!==logical Operators&& | | ! ^ & |Note:&& | |will short-circuit, the individual will not short-circuit. Short-circuit refers to the left-hand side of the code-bit operator that can draw a conclusion .>> >>> << | & ~ ^NOTE: Bitwise operators are other operators that operate on the complement of binary?: Logical Statementsif(bool) {}if(bool) {}Else{ } if(bool) {}Else if(bool) {} ...}Else{ } Switch(variable) { Casevalue 1: expression [ Break;] Case ... [default] } if(bool) {if(){ Switch(){ } } }Else{ for(){ while(){ } } } while(){ } Do{ } while() for(;;) { }
var c=10; </script> <body> <a href= "Javascript:alert (c)" >wwwww</a> <script>/*var a=false; a=0.0;//0 denotes False if (a) {alert ("11111111"); }else{alert ("000000"); } */var a=76; var b=34; Alert (A|b); </script> </body>Alert (1); document.write (' <table border= ' 1 "width=" align= "Center" > "); var i=0; while(i<100){ if(i%10==0) {var bg; if(i%2==0) BG= "#cccccc"; ElseBG= "#ffffff"; document.write (' <tr> '); } document.write (' <td> ' +i+ ' </td> '); I++; if(i%10==0) document.write (' </tr> '); } document.write (' </table> '); </script> </body>View CodeVariables and data types