Identifier Naming Conventions

The conventions are common practice, your program will still work if you do not adhere to them. Adhering to them will make your code easier to read and understand. Frequently it will make your code self-documenting.

  1. Choose full and meaningful words that describe what the variable is being used for.
    sum
    count
    index
    message
    
  2. If the identifier consists of more than one word, capitalize the first letter of each subsequent word(camel casing)

    averageScore
    totalMessages
    fullName
    createdAt
    maximumNumberOfLoginAttempts
    welcomeMessage
    
  3. Avoid starting your variable names with the "$" or "_" characters. While it's technically legal to begin your variable's name with "_", this practice is discouraged.

  4. If the name you choose consists of only one word, spell that word in all lowercase letters.

    minutes
    color
    language
    

results matching ""

    No results matching ""