Home >Web Front-end >JS Tutorial >javascript naming rules variable naming rules_basic knowledge
Hungarian nomenclature for JavaScript variables
Hungarian nomenclature syntax:
Variable name = type + object description
Type refers to the type of the variable
Object description refers to the full name or part of the name of the object, which requires Make the meaning clear and the name should be easy to remember and understand.
Tip: Although JavaScript variables do not have types on the surface, JavaScript internally assigns corresponding types to variables.
Tips: Hungarian nomenclature was invented by a Microsoft programmer. Most C and C programs use this nomenclature.
JavaScript变量起名类型 | 变量命名前缀 |
---|---|
Array 数组 | a |
Float 浮点 | l |
Function 函数 | f |
Integer(int) 整型 | n |
Object 对象 | o |
Regular Expression 正则 | r |
String 字符串 | s |