JavaScript naming rules variable naming rules _ basics

Source: Internet
Author: User
JavaScript Variable Hungarian Naming act
Hungarian name French law:

Variable name = Type + Object description
Type refers to the type of the variable
Object description refers to the name of an object or part of a name, requires a clear meaning, the name is easy to remember easy to understand.
Tip: Although JavaScript variables do not have a type on the surface, JavaScript is given the appropriate type for the variables inside.

Hint: Hungarian nomenclature was invented by a Microsoft programmer, and most c,c++ programs use this naming method.

JavaScript variable Hungarian named type

javascript variable name type variable naming prefix
Array arrays A
float float L
function functions F
Integer (int) integral type N
Object objects O
Regular Expression Regular R
String strings S
JavaScript Variable name Hungarian naming Method Example
var sweburl= "Www.jb51.net";
From the name of the variable you can see that s represents the string Weburl is the URL.

var ncheckcount=5;
From the name of the variable, you can see that n represents an integer (integer), and Checkcount represents a quantity.

Using Hungarian nomenclature is very simple and intuitive, easy to judge the types of variables, but also facilitate the reading and maintenance of the program.
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.