The most complete javascript learning guide of the whole network javascript zero basic tutorial 2022

With the rapid development of the Internet, it is increasingly inseparable from science and technology, and the birth of science and technology is based on various programming, which can also be said to constitute, so for friends who are more interested in programming, it is necessary to learn JAVA well, but how to start without professional knowledge? Let's have a look.

全网最全javascript学习指南 javascript零基础教程2022

What is JavaScript?

JavaScript is designed to add interactive behavior to HTML pages.

JavaScript is a scripting language (scripting language is a lightweight programming language).

JavaScript consists of several lines of executable computer code.

JavaScript is usually embedded directly in HTML pages.

JavaScript is an interpretive language (that is, code execution is not precompiled).

Everyone can use JavaScript without purchasing a license.

The most complete javascript learning guide of the whole network

1. Data structure:

The data structure of JavaScript includes identifier, keyword, constant, variable, etc.

Identifier: To put it bluntly, it is a name. In JavaScript, variables and functions need to define a name, which can be called "identifier". Identifier characteristics:

(1) The first character must be one of letters, underscores (_) or dollar signs, and the following characters can be letters, numbers, underscores or dollar signs; (2) Variable name cannot contain space, plus sign, minus sign and other symbols; (3) The identifier cannot have the same name as the keyword used for other purposes in JavaScript;

Keywords: JavaScript keywords refer to those words that have specific meanings in the JavaScript language and become part of the JavaScript syntax.

Constant: as the name implies, it refers to the quantity that cannot be changed. Constant is fixed from the definition until the end of the program. Constants are mainly used to provide fixed and accurate values for programs, including numeric values and strings. For example, numbers, logical values true, and logical values false are constants.

Variable: refers to the value that can be changed during program operation.

2. Data type:

JavaScript data types are classified into two categories: "basic data types" and "special data types".

Basic data type:

(1) Number type: such as integer 84, floating point 3.14; (2) String type (String type): such as "Green Leaf Learning Network"; (3) Boolean: true or false;

Special data types:

(1) Null value (null type); (2) Undefined value (undefined type); (3) Escape character;

3. Operator:

JavaScript operators can be divided into the following 5 types according to operator types:

(1) Arithmetic operator; (2) Comparison operator; (3) Assignment operator; (4) Logical operator; (5) Conditional operator;

4、 Typeof operator:

The typeof operator is used to return the type of data currently contained by its operands, which is particularly useful for judging whether a variable has been defined.

For example, the return value of typeof (1) is number, Typeof ("javascript") returns string.

5. Expression:

An expression is a collection of statements, and the calculated result is a single value. In JavaScript, there are four common expressions:

(1) Assignment expression; (2) Arithmetic expression; (3) Boolean expression; (4) String expression;

6. Type conversion:

Convert numeric data to character data: In JavaScript, the toString() method is used to convert numeric data (integer or floating point) to strings.

.toString()

Convert character type to numeric type: In JavaScript, there are two methods to convert string data to numeric data: parseInt() and parseFloat(). Among them, ParseInt() can convert string to integer data; ParseFloat () can convert strings to floating point data.

parseInt()   //Convert string type to integer type parseFloat()   //Convert string type to floating point type

7、 Basic JavaScript syntax:

Execution order: JavaScript programs are executed line by line in the order they appear in the HTML document. If it needs to be executed in the entire HTML file, it is better to put it in the tag of the HTML file. Some code, such as the code in the function body, will not be executed immediately. Only when the function is called by other programs will the code be executed.

Case sensitive: JavaScript is strictly case sensitive. For example, str and Str are two completely different variables.

Semicolon and space: In JavaScript, the semicolon ";" of a statement is optional. But we strongly require you to add a semicolon ";" after every statement, which is a very important code writing habit.

8、 JavaScript comments:

When writing JavaScript code, we often need to make comments next to some key codes, which has many benefits.

//Single line comment content /*Multi line comment content*/

9. Process control: sequence structure, selection structure, cycle structure

Jump statement: JavaScript supports two types of jump statements: break statement and continue statement. The main difference is that break statement completely ends the loop, while continue statement ends the loop. This is the same as other programming languages (such as C and Java).

(1) Break statement; (2) Continue statement;

Loop structure: In JavaScript, there are three types of loop structures:

(1) While statement; (2) Do...... While statement; (3) For statement;

Select Structure: In JavaScript, there are five types of structures:

(1) If statement; (2) If...... Else statement; (3) If...... Else if...... Statement; (4) Nesting of if statements; (5) Switch statement;

Next, type the code in the corresponding courses and books. After that, you can create a personal web page. Take action quickly. Remember to knock it line by line and it works correctly.

 shenxiaocen
  • This article is written by Published on November 4, 2022 11:56:42
  • This article is collected and sorted by the website of Mutual Benefit, and the email address for problem feedback is: wosnnet@foxmail.com , please keep the link of this article for reprinting: https://wosn.net/11912.html

Comment