Home > Web Front-end > JS Tutorial > JavaScript basic concepts_basic knowledge

JavaScript basic concepts_basic knowledge

WBOY
Release: 2016-05-16 16:19:09
Original
978 people have browsed it

1. Case sensitive

Everything in ECMAScript (variables, function names, operators) is case-sensitive.

For example, the variable names test and Test represent two different variables respectively,

2. Identifier

The so-called identifier refers to the name of a variable, function, attribute, or function parameter. An identifier is one or more characters combined according to the following format rules:

The first character must be a letter, underscore (_), or a dollar sign ($);
Other characters can be letters, underscores, dollar signs, or numbers.
ECMAScript identifiers are in camel case format, that is, the first letter is lowercase and the first letter of each remaining word is uppercase, for example: firstSecond,myCar,doSomethingImport

3. Notes

ECMAScript uses C-style comments, including single-line comments and block-level comments.

Single-line comments: start with two slashes, such as:
//Single line comment
Block-level comments start with a slash and an asterisk (/*) and end with an asterisk and a slash (*/) such as:
/*
*This is a multi-line
*(Block level) comments
*/

4. Statements

A statement in ECMAScript ends with a semicolon; if the semicolon is omitted, the parser determines the end of the statement, such as:

var sum = a b //This is a valid statement even without a semicolon -------not recommended

var diff = a - b ; //valid statement---------recommended
Although the trailing semicolon is not required, it is recommended not to omit it at any time.

5. Keywords and reserved words

Keywords and reserved words: Characters with specific purposes. These keywords can be used to indicate the beginning or end of a control statement, or to perform specific operations, etc.

Keywords and reserved words: cannot be used as identifiers or attribute names.

The above is all about the basic concepts of javascript. I hope you will like it.

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