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

How to identify it in javascript

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

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

This article mainly introduces "how to identify in javascript". In daily operation, I believe many people have doubts about how to identify in javascript. Xiaobian consulted all kinds of materials and sorted out simple and easy to use operation methods. I hope to help you answer the doubts about "how to identify in javascript"! Next, please follow the small series to learn together!

JavaScript is identified using letters, underscores "_" or dollar signs "$"; subsequent characters can also be numbers, and because JavaScript language is case-sensitive, letters can be upper-case letters from "A" to "Z" and lower-case letters from "a" to "z."

Operating environment of this article: Windows 7 system, Javascript version 1.8.5, Dell G3 computer.

What does javascript use to identify?

basis

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

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

var Früh = "foobar";

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

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

Semicolons can be omitted if a statement is exclusive to one line. This is not recommended. But if there are multiple statements on a line, they must be separated by semicolons. ECMAScript specifies automatic insertion of a semicolon (ASI) at the end of a statement. (For more information, see JavaScript Lexical Syntax.) Although not required, it is a good practice to add a semicolon to the end of a statement. This habit can greatly reduce the likelihood of bugs in your code.

Javascript source code is scanned from left to right and converted into a series of input elements consisting of tokens, control characters, line terminators, comments, and whitespace characters. White space characters refer to spaces, tabs, newlines, etc.

variables

In applications, variables are used as symbolic names for values. Variable names are also called identifiers, which are subject to certain rules.

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

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

Examples of legal identifiers: Number_hits, temp99,$credit, and_name.

declare variables

You can declare variables in three ways:

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

Direct assignment. For example, x = 42. Using this form of assignment outside a function produces a global variable. Errors occur in strict mode. Therefore you should not declare variables in this way.

Use the keyword let. Let y = 13. This syntax can be used to declare block-scoped local variables. Refer to the variable scope below.

At this point, the study of "how to identify in javascript" is over, hoping to solve everyone's doubts. Theory and practice can better match to help you learn, go and try it! If you want to continue learning more relevant knowledge, please continue to pay attention to the website, Xiaobian will continue to strive to bring more practical articles for everyone!

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: 0

*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