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 are the basic characteristics of javascript

2025-01-20 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

In this article, the editor introduces in detail "what are the basic characteristics of javascript", the content is detailed, the steps are clear, and the details are handled properly. I hope this article "what are the basic characteristics of javascript" can help you solve your doubts? let's follow the editor's way of thinking to learn new knowledge.

JavaScript is an object-based (Object) and event-driven (Event Driven) scripting language with security performance.

The emergence of JavaScript makes up for the deficiency of HTML language. It is a compromise between Java and HTML and has the following basic characteristics.

1. Script writing

JavaScript is a scripting language that uses Mini Program segments to program. As an interpretive language, it does not need to be compiled, but is interpreted line by line during the running of the program.

2. Object-based

JavaScript is an object-based language, which means it can use objects it has created. As a result, many features can be derived from the methods of objects in the JavaScript runtime environment (that is, the browser itself) to interact with JavaScript objects.

3. Simplicity

First of all, the simplicity of JavaScript is mainly reflected in its basic statement and control flow based on Java, which is a simple and compact language, which is a very good excess for learning Java; second, its variable type is "weak type" and does not use strict data types.

4. Security

JavaScript is a security language, it does not allow access to the local hard disk, and can not store data on the server; does not allow modification and deletion of network documents, can only achieve information browsing or dynamic interaction through the browser, so as to effectively prevent the loss of data.

5. Dynamic

JavaScript is dynamic and can respond directly to user or customer input without going through a Web service program. It responds to users in an event-driven manner. The so-called event-driven refers to the actions generated by performing certain actions on the page, such as pressing the mouse, moving the window or selecting a menu, which can be regarded as events, which will cause the corresponding event response when the event occurs.

6. Cross-platform

JavaScript depends only on the browser itself and has nothing to do with the operating system, as long as it is a computer that can run a browser and a browser that supports JavaScript can execute correctly. In order to realize the dream of "write it and go all over the world".

1. Object-based and object-oriented

Java is a true object-oriented language, even if you are developing a simple program, you must design objects. JavaScript is a scripting language that can be used to make complex software that has nothing to do with the network and interacts with users. It is an object based (Object Based) and event driven (Event Driver) programming language. Therefore, it provides a very rich internal objects for designers to use.

2. Interpretation and compilation

The two languages perform differently in their browsers. The source code of Java must be compiled before it is passed to the client for execution, so the client must have a simulator or interpreter on the corresponding platform, which can realize the bondage of compiling code independent of a particular platform through the compiler or interpreter. JavaScript is an interpretive programming language, whose source code does not need to be compiled before it is sent to the client for execution, but sends the character code in text format to the client to be interpreted and executed by the browser.

3. Strong variables and weak variables

The variables taken by the two languages are different. Java uses strongly typed variable checking, that is, all variables must be declared before compilation. Variable declaration in JavaScript, with its weak type. That is, variables do not need to be declared before they are used, but the interpreter checks their data types at run time

4. The code format is different

Java is an HTML-independent format that must be loaded as external media is referenced in HTML, and its code is stored in a separate document as bytecode. The JavaScript code is a text character format that can be embedded directly into an HTML document and can be loaded dynamically. Writing an HTML document is as convenient as editing a text file.

5. Different embedding methods

In HTML documents, the identifiers of the two programming languages are different. JavaScript is used to identify them, while Java uses... To identify or use the java scripting language.

6. Static binding and dynamic binding

Java uses static binding, that is, object references to Java must be done at compile time to enable the compiler to implement strong type checking. JavaScript uses dynamic binding, that is, object references of JavaScript are checked at run time, and object references cannot be checked without compilation.

1. JavaScript is directly embedded in the HTML file.

Write between head or body tag pairs, tagged as follows

2. JavaScript programs are stored separately.

Js file, and then link in the HTML file. Just write the javascript code directly in the js file.

There are four basic data types in JavaScript:

1. Numeric (integers and real numbers)

two。 String type (character or numeric value enclosed by "" or "sign)

3. Boolean (represented by true or false)

4. Null value (null)

The amount of variable value during the execution of a program is a named storage unit in the system memory.

The variable name begins with a letter, with numbers and underscores in the middle. Variable names cannot have spaces, +, or other symbols

You cannot use the keyword of JavaScript as a variable. Such as: var, int, double, delete

The first word of the variable name is all lowercase, the second word begins with the first letter of each word in uppercase, and the rest in lowercase.

There are global variables and local variables in JavaScript. When a global variable is defined outside the body of all functions, its scope of action

Are all functions; local variables are defined within the body of the function and are visible only to that function.

The amount whose value cannot be changed during the execution of the program.

1. Integer constant

For example, 123512

2. Real constant

Real constants are represented by integer parts plus decimal parts, such as 3.14 # 12.43, etc., or they can be expressed by scientific or standard methods, such as 5E7 ~ 4e5, etc.

3. Boolean value

Boolean constants have only two values, true or false. Mainly used to describe or represent a state or flag to control the flow of operation.

4. Character type constant

Character-type constants are strings enclosed in single quotation marks (') or double quotation marks ("). For example, the character'a constant, the string" hello ".

JavaScript also supports special characters that cannot be displayed, often referred to as control characters, that begin with a backslash (\). For example, newline character'\ r'), tab character ('\ t'), etc.

5. Null value

There is a null value of null in JavaScript, which means there is nothing. If you try to reference an undefined variable, a null value is returned.

After reading this, the article "what are the basic characteristics of javascript" has been introduced. If you want to master the knowledge points of this article, you still need to practice and use it yourself to understand it. If you want to know more about related articles, welcome to 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: 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

Development

Wechat

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

12
Report