Home > Web Front-end > JS Tutorial > js basics improvement teaching variables

js basics improvement teaching variables

php中世界最好的语言
Release: 2018-06-04 13:57:53
Original
1180 people have browsed it

This time I will bring you variables to improve the teaching of js basics. What are the precautions for using js variables? The following is a practical case, let’s take a look.

In a normal language, everything before the function belongs to the basic part

Format: var Variable nameName = variable value; (In version 135, a statement must be added, that is Strict mode)

--------------------------------->> var is called variable declaration, javascript It is recommended to add that python actually omits the

naming rules:

1. Numbers, letters, underscores, $ form

2. The first letter cannot Start with a number

(Various programming languages are different, some name pictures with numbers, the computer will treat it as if the memory cannot be found, and the entire code will report an error)

3. Do not use keywords or reserved words

(Reserved words mean that developers think this word will be used in the future, but it is not used now)

4. Naming should be meaningful

5. It is recommended to use camel case or underline method, with the first letter lowercase (for example: userName, user_name)

6. The latest naming convention is in Add an underscore in front (such as _userName)

I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to other related articles on the php Chinese website!

Recommended reading:

REM relative unit usage case sharing

How to use li for horizontal arrangement

The above is the detailed content of js basics improvement teaching variables. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template