Skip to content

Space before left parenthesis in anonymous function literals #55

@siclait

Description

@siclait

From Crockford:

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.

div.onclick = function (e) {
  return false;
};

that = {
  method: function () {
    return this.datum;
  },
  datum: 0
};

Source: Code Conventions for the JavaScript Programming Language

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions