Skip to content

Code Conventions

Manuel Mejia edited this page Apr 10, 2016 · 10 revisions

JS

Type of variables:

let: the variable may be reassigned.

const: the variable can’t be reassigned.

Naming variables:

We are using the Hungarian notation, Example:

let carColor

const houseDoorSize

Formatting:

This how we're going to formatting our code. If one condition use brackets, all the conditions will need brackets too.

Ex #1:

if (condition) {
    //Multiple lines
} else {
    //One line
}

Ex #2:

 if (condition) 
    //One line 
 else 
    //One line

Spacing:

We are using four-character indents, Ex:

if( car.id == 79){
    car.color = blue;
    var wheels =  car.wheels;
}

Clone this wiki locally