<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="http://wiki.darenet.org/skins/common/feed.css?12"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
	<channel>
		<title>Web Development/Javascript Coding Standards - Revision history</title>
		<link>http://wiki.darenet.org/index.php?title=Web_Development/Javascript_Coding_Standards&amp;action=history</link>
		<description>Revision history for this page on the wiki</description>
		<language>en</language>
		<generator>MediaWiki 1.15.1</generator>
		<lastBuildDate>Sat, 02 May 2026 15:24:42 GMT</lastBuildDate>
		<item>
			<title>Admin at 08:13, 16 June 2011</title>
			<link>http://wiki.darenet.org/index.php?title=Web_Development/Javascript_Coding_Standards&amp;diff=6319&amp;oldid=prev</link>
			<description>&lt;p&gt;&lt;/p&gt;

		&lt;table style=&quot;background-color: white; color:black;&quot;&gt;
		&lt;col class='diff-marker' /&gt;
		&lt;col class='diff-content' /&gt;
		&lt;col class='diff-marker' /&gt;
		&lt;col class='diff-content' /&gt;
		&lt;tr valign='top'&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 08:13, 16 June 2011&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;{{Header|1 = &amp;lt;h2&amp;gt;'''[[Web Development]]''' - Javascript Coding Standards&amp;lt;/h2&amp;gt;}}&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;This document outlines technical and style guidelines which are followed in website-darenet. Contributors should also follow these guidelines.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;This document outlines technical and style guidelines which are followed in website-darenet. Contributors should also follow these guidelines.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;!-- diff generator: internal 2026-05-02 15:24:42 --&gt;
&lt;/table&gt;</description>
			<pubDate>Thu, 16 Jun 2011 08:13:56 GMT</pubDate>			<dc:creator>Admin</dc:creator>			<comments>http://wiki.darenet.org/Talk:Web_Development/Javascript_Coding_Standards</comments>		</item>
		<item>
			<title>Admin:&amp;#32;/* Leading Underscores */</title>
			<link>http://wiki.darenet.org/index.php?title=Web_Development/Javascript_Coding_Standards&amp;diff=6314&amp;oldid=prev</link>
			<description>&lt;p&gt;&lt;span class=&quot;autocomment&quot;&gt;Leading Underscores&lt;/span&gt;&lt;/p&gt;

		&lt;table style=&quot;background-color: white; color:black;&quot;&gt;
		&lt;col class='diff-marker' /&gt;
		&lt;col class='diff-content' /&gt;
		&lt;col class='diff-marker' /&gt;
		&lt;col class='diff-content' /&gt;
		&lt;tr valign='top'&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 08:10, 16 June 2011&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 88:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 88:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;The upshot here is:&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;The upshot here is:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;* &lt;/ins&gt;name internal methods which shouldn't be called outside of a file's scope with a leading underscore; and&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;name internal methods which shouldn't be called outside of a file's scope with a leading underscore; and&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;* &lt;/ins&gt;never call an internal method from another file.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;never call an internal method from another file.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;If you treat them as though they were &amp;quot;private&amp;quot;, you won't run into problems.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;If you treat them as though they were &amp;quot;private&amp;quot;, you won't run into problems.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;!-- diff generator: internal 2026-05-02 15:24:42 --&gt;
&lt;/table&gt;</description>
			<pubDate>Thu, 16 Jun 2011 08:10:36 GMT</pubDate>			<dc:creator>Admin</dc:creator>			<comments>http://wiki.darenet.org/Talk:Web_Development/Javascript_Coding_Standards</comments>		</item>
		<item>
			<title>Admin:&amp;#32;Created page with 'This document outlines technical and style guidelines which are followed in website-darenet. Contributors should also follow these guidelines.  ==Spaces, Linebreaks and Indentati…'</title>
			<link>http://wiki.darenet.org/index.php?title=Web_Development/Javascript_Coding_Standards&amp;diff=6313&amp;oldid=prev</link>
			<description>&lt;p&gt;Created page with &amp;#39;This document outlines technical and style guidelines which are followed in website-darenet. Contributors should also follow these guidelines.  ==Spaces, Linebreaks and Indentati…&amp;#39;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;This document outlines technical and style guidelines which are followed in website-darenet. Contributors should also follow these guidelines.&lt;br /&gt;
&lt;br /&gt;
==Spaces, Linebreaks and Indentation==&lt;br /&gt;
* Use one tab for each level of identation.&lt;br /&gt;
* Use Unix linebreaks (&amp;quot;\n&amp;quot;), not MSDOS (&amp;quot;\r\n&amp;quot;) or OS9 (&amp;quot;\r&amp;quot;).&lt;br /&gt;
* Use K&amp;amp;R style braces and spacing.&lt;br /&gt;
* Put a space after control keywords like if and for.&lt;br /&gt;
* Put a space after commas in argument lists.&lt;br /&gt;
* Put space around operators like =, &amp;lt;, etc.&lt;br /&gt;
* Don't put spaces after function names.&lt;br /&gt;
* Parentheses should hug their contents.&lt;br /&gt;
* Generally, prefer to wrap code at 80 columns.&lt;br /&gt;
&lt;br /&gt;
==Case and Capitalization==&lt;br /&gt;
The Javascript language unambiguously dictates casing/naming rules; follow those rules.&lt;br /&gt;
&lt;br /&gt;
* Name variables using lowercase_with_underscores.&lt;br /&gt;
* Name classes using UpperCamelCase.&lt;br /&gt;
* Name methods and properties using lowerCamelCase.&lt;br /&gt;
* Name global functions using lowerCamelCase. Avoid defining global functions.&lt;br /&gt;
* Name constants using UPPERCASE.&lt;br /&gt;
* Write true, false, and null in lowercase.&lt;br /&gt;
* &amp;quot;Internal&amp;quot; methods and properties should be prefixed with an underscore. For more information about what &amp;quot;internal&amp;quot; means, see Leading Underscores, below.&lt;br /&gt;
&lt;br /&gt;
==Comments==&lt;br /&gt;
* Strongly prefer // comments for making comments inside the bodies of functions and methods (this lets someone easily comment out a block of code while debugging later).&lt;br /&gt;
&lt;br /&gt;
==Javascript Language==&lt;br /&gt;
* Use [] and {}, not new Array and new Object.&lt;br /&gt;
* When creating an object literal, do not quote keys unless required.&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
===if/else:===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;javascript&amp;gt;if (x &amp;gt; 3) {&lt;br /&gt;
  // ...&lt;br /&gt;
} else if (x === null) {&lt;br /&gt;
  // ...&lt;br /&gt;
} else {&lt;br /&gt;
  // ...&lt;br /&gt;
}&amp;lt;/javascript&amp;gt;&lt;br /&gt;
You should always put braces around the body of an if clause, even if it is only one line. Note that operators like &amp;gt; and === are also surrounded by spaces.&lt;br /&gt;
&lt;br /&gt;
===for (iteration):===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;javascript&amp;gt;for (var ii = 0; ii &amp;lt; 10; ii++) {&lt;br /&gt;
  // ...&lt;br /&gt;
}&amp;lt;/javascript&amp;gt;&lt;br /&gt;
Prefer ii, jj, kk, etc., as iterators, since they're easier to pick out visually and react better to &amp;quot;Find Next...&amp;quot; in editors.&lt;br /&gt;
&lt;br /&gt;
===for (enumeration):===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;javascript&amp;gt;for (var k in obj) {&lt;br /&gt;
  // ...&lt;br /&gt;
}&amp;lt;/javascript&amp;gt;&lt;br /&gt;
Make sure you use enumeration only on Objects, not on Arrays.&lt;br /&gt;
&lt;br /&gt;
===switch:===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;javascript&amp;gt;switch (x) {&lt;br /&gt;
  case 1:&lt;br /&gt;
    // ...&lt;br /&gt;
    break;&lt;br /&gt;
  case 2:&lt;br /&gt;
    if (flag) {&lt;br /&gt;
      break;&lt;br /&gt;
    }&lt;br /&gt;
    break;&lt;br /&gt;
  default:&lt;br /&gt;
    // ...&lt;br /&gt;
    break;&lt;br /&gt;
}&amp;lt;/javascript&amp;gt;&lt;br /&gt;
break statements should be indented to block level. If you don't push them in, you end up with an inconsistent rule for conditional break statements, as in the 2 case.&lt;br /&gt;
&lt;br /&gt;
If you insist on having a &amp;quot;fall through&amp;quot; case that does not end with break, make it clear in a comment that you wrote this intentionally. For instance:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;javascript&amp;gt;switch (x) {&lt;br /&gt;
  case 1:&lt;br /&gt;
    // ...&lt;br /&gt;
    // Fall through...&lt;br /&gt;
  case 2:&lt;br /&gt;
    //...&lt;br /&gt;
    break;&lt;br /&gt;
}&amp;lt;/javascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Leading Underscores==&lt;br /&gt;
By convention, methods names which start with a leading underscore are considered &amp;quot;internal&amp;quot;, which (roughly) means &amp;quot;private&amp;quot;. The critical difference is that this is treated as a signal to Javascript processing scripts that a symbol is safe to rename since it is not referenced outside the current file.&lt;br /&gt;
&lt;br /&gt;
The upshot here is:&lt;br /&gt;
&lt;br /&gt;
name internal methods which shouldn't be called outside of a file's scope with a leading underscore; and&lt;br /&gt;
never call an internal method from another file.&lt;br /&gt;
&lt;br /&gt;
If you treat them as though they were &amp;quot;private&amp;quot;, you won't run into problems.&lt;/div&gt;</description>
			<pubDate>Thu, 16 Jun 2011 08:10:14 GMT</pubDate>			<dc:creator>Admin</dc:creator>			<comments>http://wiki.darenet.org/Talk:Web_Development/Javascript_Coding_Standards</comments>		</item>
	</channel>
</rss>