Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • D digitec-wiki
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 0
    • Issues 0
    • List
    • Boards
    • Service Desk
    • Milestones
  • Deployments
    • Deployments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • Digitec
  • digitec-wiki
  • Wiki
  • javascript coding standards

javascript coding standards · Changes

Page history
rcabral deleted page: backspace contact information authored Mar 29, 2016 by Rene Cabral's avatar Rene Cabral
Show whitespace changes
Inline Side-by-side
javascript-coding-standards.markdown
View page @ a18eed05
...@@ -99,30 +99,30 @@ There should be no space between the name of a function and the `(` (left parent ...@@ -99,30 +99,30 @@ There should be no space between the name of a function and the `(` (left parent
This convention works well with JavaScript because in JavaScript, functions and object literals can be placed anywhere that an expression is allowed. It provides the best readability with inline functions and complex structures. This convention works well with JavaScript because in JavaScript, functions and object literals can be placed anywhere that an expression is allowed. It provides the best readability with inline functions and complex structures.
```javascript ```javascript
    function getElementsByClassName(className) { function getElementsByClassName(className) {
        var results = []; var results = [];
        walkTheDOM(document.body, function (node) { walkTheDOM(document.body, function (node) {
            var a;                  // array of class names var a; // array of class names
            var c = node.className; // the node's classname var c = node.className; // the node's classname
            var i;                  // loop counter var i; // loop counter
// If the node has a class name, then split it into a list of simple names. // If the node has a class name, then split it into a list of simple names.
// If any of them match the requested name, then append the node to the set of results. // If any of them match the requested name, then append the node to the set of results.
            if (c) { if (c) {
                a = c.split(' '); a = c.split(' ');
                for (i = 0; i < a.length; i += 1) { for (i = 0; i < a.length; i += 1) {
                    if (a[i] === className) { if (a[i] === className) {
                        results.push(node); results.push(node);
                        break; break;
                    } }
                } }
            } }
        }); });
        return results; return results;
    } }
``` ```
If a function literal is anonymous, there should be one space between the word `function` and the `(` (left parenthesis). If the space is omited, then it can appear that the function's name is `function`, which is an incorrect reading. If a function literal is anonymous, there should be one space between the word `function` and the `(` (left parenthesis). If the space is omited, then it can appear that the function's name is `function`, which is an incorrect reading.
......
Clone repository
  • alpha beta testing
  • browser testing
  • camtasia licenses
  • code delivery processes
  • coding practices
  • css and sass coding standards
  • database schema standards
  • dependency management
  • development environments
  • digitec agile process
  • digitec gitlab styles
  • digitec software promises
  • digitec spec process
  • gitlab administration
  • gitlab issues tags
View All Pages