This project, simply put, provides coding conventions for the JavaScript community.
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

JavaScript Community Coding Conventions

The JavaScript community needs general coding conventions, and this is what this project aims to provide.

These coding conventions are based on what the general crowd seems to use. Thorough analysis of several different frameworks and libraries have been done to find the best conventions for everybody.

Example code

function foo(x, y, z) {
    // A function call.
    bar(1, b);
    var i = 0;
    var x = {foo: "zero", bar: "one"};
    // Alternatively, you can rely on one "var":
    var i = 0,
        j = 0;
    var foo = function() {
    if (!i > 10) {
        for (var j = 0; j < 10; j++) {
            switch (j) {
                case 0:
                    value = "zero";
                case 1:
                    value = "one";
            var c = j > 5 ? "GT 5" : "LE 5";
    } else {
        var j = 0;
        try {
            while (j < 10) {
                if (i === j || j > 5) {
                    a[j] = i + j * 12;
                i = (j << 2) & 4;
            do {
            } while (j > 0)
        } catch (e) {
            alert("Failure: " + e.message);
        } finally {
            reset(a, i);

Code style


Indentation is done with a single tab character. The size of the tab can be customized per your preference (usually 4).

Using a tab as opposed to multiple spaces serve two benefits:

Great adjustability

The indentation size can be adjusted per each developer, per each development environment. This is very useful, because not everyone prefer the same level of indentation.

It should also be noted that on a 2560x1440 monitor you are more likely to use six (6) spaces wide indentation, as opposed to a 1680x1050 monitor, for instance.

Indentation is important as code often tends to grow to the right, especially in JavaScript with functional and callback heavy code.

No hidden mistakes

When using spaces for indentation, careless people (coders) end up having "hidden" mistakes at times:

var b;
if (foo) {
    var a = 1;
     b = {
        foo: 1,
        bar: 2

Having an extra space (or missing one) is a common place in space-oriented code. This problem does not exist in tab-oriented code because the mistake would be clear.