diff options
author | wout <wout@impinc.co.uk> | 2014-07-29 15:42:32 +0200 |
---|---|---|
committer | wout <wout@impinc.co.uk> | 2014-07-29 15:42:32 +0200 |
commit | 411a621d7ac1b84c684d59b99bd4979f28805a64 (patch) | |
tree | 3298d98ac3e3a887ae8cc406b6c1fd6920a4c3e6 | |
parent | 5e9ab52bd68670208ac25cfcf95cca178d285545 (diff) | |
download | svg.js-411a621d7ac1b84c684d59b99bd4979f28805a64.tar.gz svg.js-411a621d7ac1b84c684d59b99bd4979f28805a64.zip |
Updated README
-rwxr-xr-x | README.md | 25 |
1 files changed, 24 insertions, 1 deletions
@@ -3501,7 +3501,7 @@ Here are a few nice plugins that are available for SVG.js: ## Contributing -We love contributions. Yes indeed, I used the word LOVE! But please make sure you follow the same coding style. Here are some guidelines. +We love contributions. Yes indeed, we used the word LOVE! But please make sure you follow the same coding style. Here are some guidelines. ### Indentation We do it with __two spaces__. Make sure you don't start using tabs because then things get messy. @@ -3531,6 +3531,29 @@ for (var i = 0; i < 5; i++) { }; ``` +### Minimize variable declarations +All local variables should be declared at the beginning of a function or method unless there is ony one variable to declare. Although it is not required to assign them at the same moment. When if statements are involved, requiring some variables only to be present in the statement, the necessary variables should be declared right after the if statement. + +__Good__: +```javascript +function reading_board() { + var aap, noot, mies + + aap = 1 + noot = 2 + mies = aap + noot +} +``` + +__Bad__: +```javascript +function reading_board() { + var aap = 1 + var noot = 2 + var mies = aap + noot +} +``` + ### Let your code breathe people! Don't try to be a code compressor yourself, they do way a better job anyway. Give your code some spaces and newlines. |