JS Debugging & Basic Syntax

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.