Skip to content

Latest commit

 

History

History
36 lines (31 loc) · 823 Bytes

JavaScript.md

File metadata and controls

36 lines (31 loc) · 823 Bytes

JavaScript Coding Guidelines

Names

camelCase is used for function and method names

function thisIsMyFunctionName() {...}
var fullName = "Test";

PascalCase is used for type names

Use concise names!

Documentation

Use JSDoc style comments when documenting code

/** This function will display "Hello World" */
function showHelloWorld() {
    alert("Hello World");
}

Curly Braces

For code blocks it is recommended to start the opening curly brace at the end of the current line and put the closing brace on a separate line indented at the same level as the starting block of code.

if (true) {
    if (someCondition) {
        // Code here...
    }
    else if (something else) {
        // More code here...
    }
}