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

Related Article

Alibaba Cloud 10 Year Anniversary

With You, We are Shaping a Digital World, 2009-2019

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

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: and provide relevant evidence. A staff member will contact you within 5 working days.