Bad:

    Good:

    1. function hashIt(data) {
    2. let hash = 0;
    3. const length = data.length;
    4. const char = data.charCodeAt(i);
    5. hash = ((hash << 5) - hash) + char;
    6. // Convert to 32-bit integer
    7. hash &= hash;
    8. }
    9. }

    Version control exists for a reason. Leave old code in your history.

    Good:

    1. doStuff();

    Remember, use version control! There’s no need for dead code, commented code,
    and especially journal comments. Use git log to get history!

    Bad:

    1. function combine(a, b) {
    2. }

    They usually just add noise. Let the functions and variable names along with the
    proper indentation and formatting give the visual structure to your code.

    Bad:

    Good:

    1. $scope.model = {
    2. menu: 'foo',
    3. nav: 'bar'
    4. };
    5. const actions = function() {
    6. };