Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What does javascript use to identify

2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)05/31 Report--

Most people do not understand the knowledge points of this article "what javascript uses to identify", so the editor summarizes the following content, detailed content, clear steps, and has a certain reference value. I hope you can get something after reading this article. Let's take a look at this "what does javascript use to identify" article.

Javascript is identified with letters, an underscore "_", or the dollar sign "$"; subsequent characters can also be numbers, and because the JavaScript language is case-sensitive, letters can be uppercase letters from "A" to "Z" and lowercase letters from "a" to "z".

This article operating environment: windows7 system, javascript1.8.5 version, Dell G3 computer.

What does javascript use to identify it?

Basics

JavaScript borrows most of the syntax of Java, but it is also influenced by Awk,Perl and Python.

JavaScript is case-sensitive and uses the Unicode character set. For example, the word Fr ü h (which means "early" in German) can be used as a variable name.

Var Fr ü h = "foobar"

However, because JavaScript is case-sensitive, the variables fr ü h and Fr ü h are two different variables.

In JavaScript, instructions are called statements (Statement) and are separated by semicolons (;).

If a statement has a single line, the semicolon can be omitted. (translator's note: this is not recommended. However, if there are multiple statements in a line, they must be separated by semicolons ECMAScript specifies that a semicolon (ASI) is automatically inserted at the end of the statement. For more information, see JavaScript Lexical Grammar. Although not required, it is a good habit to add a semicolon at the end of a statement This habit can greatly reduce the possibility of generating bug in your code.

The Javascript source code is scanned from left to right and converted into a series of input elements consisting of token, control characters, line Terminators, comments, and white space characters. White space characters refer to spaces, tabs, newline characters, and so on.

Variable

In an application, variables are used as the symbolic name of the value. The name of a variable is also called an identifier, which needs to follow certain rules.

An JavaScript identifier must start with a letter, an underscore (_), or a dollar sign ($); subsequent characters can also be numbers (0-9). Because the JavaScript language is case-sensitive, letters can be uppercase letters from "A" to "Z" and lowercase letters from "a" to "z".

You can use most ISO 8859-1 or Unicode encoded characters as identifiers, such as å and ü (see this blog post for details). You can also use Unicode escape characters as identifiers.

Examples of valid identifiers: Number_hits,temp99,$credit and _ name.

Declare variable

You can declare variables in three ways:

Use the keyword var. For example, var x = 42. This syntax can be used to declare local and global variables.

Direct assignment. For example, x = 42. Using this form of assignment outside the function produces a global variable. Errors can occur in strict mode. So you shouldn't declare variables in this way.

Use the keyword let. For example, let y = 13. This syntax can be used to declare local variables in the block scope. Refer to the scope (Variable scope) of the variables below.

The above is about the content of this article on "what javascript uses to identify". I believe we all have a certain understanding. I hope the content shared by the editor will be helpful to you. If you want to know more about the relevant knowledge, please follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 297

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report