JavaScript guidelines _ basic knowledge

Source: Internet
Author: User
JavaScript guidelines This section describes other important things that need to be understood when JavaScript is used for encoding.
JavaScript is case sensitive.
A function named "myfunction" and a function named "myFunction" are two different functions. Similarly, variables "myVar" and variables "myvar" are different.

JavaScript is case sensitive-so when you create or use variables, objects, and functions, pay attention to the Case sensitivity of characters.
Space
JavaScript ignores unnecessary spaces. Therefore, you can add appropriate spaces in the code to make the code more readable. The following two rows are equivalent:

Name = "Hege"
Name = "Hege" newline
You can use a backslash to line the code inside the string. The following example is correct:

Document. write ("Hello \
World! ") But cannot be broken like this:

Document. write \
("Hello World! ") Notes:
You can use two slashes to add comments:

// This is a comment
Document. write ("Hello World! ") You can also use/* and */: (in this way, you can create comments for multiple rows)

/* This is a comment
Block. It contains
Several lines */

Document. write ("Hello World! ")
Related Article

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.