Code Log

プログラミングの勉強メモを残していきます。

JavaScript Rules for naming variables


スポンサーリンク

*camelCase

If a variable name is more than one word, it is usually written in camelCase.
This means the first word is all lowercase and any subsequent words have their first letter capitalized.


*DATA TYPES

JavaScript distinguishes between numbers, strings, and true or false values known as Booleans.

  • Numeric Data Type
  • String Data Type
  • Boolean Data Type


*Rules for naming variables

  1. The name must begin with a letter, dollar sign($), or an underscore(_). It must not start with a number.
  2. The name can contain letters, numbers, dollar sing($), or an underscore(_). Note that you must not use a dash(-) or a period(.) in a variable name.
  3. You cannot use keywords or reserved words. Keywords are special words that tell the interpreter to do something.
    For example, var is a keyword used to declare a variable. Reservled words are ones that may be used in a future version of JavaScript.
  4. All variables are case sensitive
  5. Use a name that describes the kind of information that the variable stores.
  6. If your variable name is made up of more than one word, use a capital letter for the first letter of every word after the first word.