Created
September 15, 2011 17:41
-
-
Save syranez/1219930 to your computer and use it in GitHub Desktop.
Codingstyle: JavaScript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var module = (function() { | |
/** | |
* Berechnet die Längendifferenz der zwei Strings und gibt sooft den ersten String aus. | |
* | |
* Ist baz.length <= bar.length, wird nur baz ausgegeben. | |
* | |
* @param string bar | |
* @param string baz | |
*/ | |
function foo (bar, baz) { | |
var someVar = "some text"; | |
var length = bar.length - baz.length; | |
for (var i = 0; i < length; i += 1) { | |
console.log(bar); | |
} | |
console.log(baz); | |
}; | |
return { | |
foo: foo | |
}; | |
})(); | |
module.foo("coding", "style"); | |
/** | |
* Codingstyle: | |
* | |
* 0) Immer Semikolons setzen. | |
* 1) Kein Leerzeichen zwischen Funktionsname und () bei Funktionsaufrufen. | |
* 2) Eine Leerzeile zwischen Funktionsdefinitionskopf und Funktionskörper. | |
* 3) Eine Variablendefinition pro Zeile. | |
* | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment