2.javascript identifier

javascript identifier

  • In js, everything that can be named by ourselves can be called an identifier.

  • For example: variable names, function names, and attribute names are all identifiers

  • Rules to follow when naming an identifier:

    1. The identifier can contain letters, numbers, _underscore, $

    2. The identifier cannot start with a number

    3. Identifiers cannot be keywords or reserved words in ES
    Insert picture description here

    4. Identifiers generally adopt camel case naming: the first letter is lowercase, the beginning of each word is uppercase, and the remaining letters are lowercase. For example: helloWord

lower case. For example: helloWord

  • The Unicode encoding is actually used when storing identifiers at the bottom of JS, so in theory, all the content contained in utf-8 can be used as identifiers, and Chinese can also be used as identifiers, but it is not recommended.

Guess you like

Origin blog.csdn.net/weixin_46475440/article/details/108485858