编程语言/命名:修订间差异
来自康健生活
| 第10行: | 第10行: | ||
== 命名方法 == | == 命名方法 == | ||
=== 匈牙利表示法 === | === 匈牙利表示法 === | ||
== 其他 == | |||
=== 函数命名 === | |||
==== 普通函数命名 ==== | |||
构造函数首字母应该{{underline|小|bule}}写<ref>Douglas Crockford. JavaScript: The Good Parts. O'Reily. 2008.</ref>。 | |||
<syntaxhighlight lang="javascript"> | |||
var nowDateLength = dateLength(nowDate); // dateLength is a ordinary function.</syntaxhighlight> | |||
==== 构造函数命名 ==== | |||
构造函数首字母应该{{underline|大|bule}}写。 | |||
<syntaxhighlight lang="javascript"> | |||
var nowDate = new DateFormat(); // DateFormat is a constructor function.</syntaxhighlight> | |||
== 实例 == | == 实例 == | ||