JavaScript namespaces: Naming rules and methods in JavaScript

Source: Internet
Author: User
Tags lowercase string variable

JavaScript variable names are subject to two simple rules:
1. The first character must be a letter, an underscore (_), or a dollar sign ($).
2, the remaining characters can be underlined, dollar sign or any letter or numeric character.
Name Method:
1, camel notation-the first letter is lowercase, the next words are capitalized letters begin. Such as:
var mytestvalue = 0, Mysecondtestvalue = "HI";
2, Pascal notation--The first letter is capitalized, the next words are capitalized letters start. Such as:
var mytestvalue = 0, Mysecondtestvalue = "HI";
3. Hungarian type notation--Appends a lowercase letter (or lowercase alphabetical sequence) to a variable named after the Pascal notation, indicating the type of the variable. For example, I represents an integer and S represents a string, such as:
var imytestvalue = 0, Smysecondtestvalue = "HI";
The common prefixes are listed below:
Type Prefix Example
Array A Avalue
Boolean type B Bfound
Floating-point type F Fvalue
Function Fn Fnmethod
Integral type I Ivalue
Object O Otype
Regular expressions Re Repattern
String S Svalue
Variable V Vvalue
This article links http://www.cxybl.com/html/wyzz/JavaScript_Ajax/20120608/28903.html

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.