JS DebuggingOpen Chrome's debug panel f12control+shift+i right-"Check the debugger in sources in the debug panel
Basic SyntaxVariable Object ... expression Function statement Write program Direct amount var number = 1; Variable declaration variable var age;var age, name, sex; var age = 12; identifier var age = 12;function Add (num1, num2) {return num1+num2;} var student = {Name: "Xiaoming"} Naming requirements--start with a letter, underscore, or dollar sign ($)--a sample of the alphabet, underscore, dollar sign ($), and number example var abc;var _abc;var $abc; var _abc1$;functi On $ $abc _ () {} above legal var 1abc;var *abc;var abc&; above illegal keyword and reserved word var case = 1; syntaxerror:missing variable namecase and keywords are case sensitive var age = 10;var Age = 20;document.write (age);d ocument.write (age); The statement var sex = 1;if (sex = = 1) {document.write (male);} else {...} while (number < 1000) {...} recommendations: 1, end with a semicolon (although you can not Write, but it is recommended to use the end of the semicolon, to ensure that the statement will not be re-modified and compressed when the error occurs) 2, the statement can be nested 3, multiple statements can be placed in a code block using curly braces to come to comment comments have two line-level comments//block-level comments/**/Comments: The role of the interpreter to help Can comment on some unwanted code, leaving the useful code
JS Debugging & Basic Syntax