The use of javascript 01 basic part

1. To achieve such an effect

1.1 There is a mobile phone registration verification function here, I can set the registration page in advance, it is safe,

2 In actual work, if you find that there is no background data, you can only wait (the process is to have an interface, and then use the interface to transfer the data), (1. The core of realizing data interaction is to think about how to define Excuse. 2. What kind of data is the excuse to return, and what is the data format?

2.1

3. For JavaScript, MDN is more authoritative

Link address of MDN: https://developer.mozilla.org/zh-CN/docs/Web/JavaScript https://developer.mozilla.org/zh-CN/docs/Web/JavaScript

3.1

4 Click this button to enter and switch to Chinese

4.1

5. Experience Java Script to achieve interactive effects

5.1 Make this effect

5.1 Operation case code

5.2 Get the click button and bind the event

5.3 The meaning of the following function is to take the class, so that it does not change color

5.4 document means to cancel the previous binding, and the next sentence is currently clicked, to be replaced

6. js location, inline, internal and external

7. The inside must be written on the body

7.1

8 internal code

8.1

9 External import through script src file

9.1

10 Inline Java Script Links

10.1

11. Notes on JavaScript

11.1

12 The terminator is;

12.1

13 Input and output syntax

13.1

14. The meaning of this code is to let the page output the content through the js method

 

14.1

15 write will be written in the body, and the page elements are also inside

15.1

16 The console is used for debugging, and the other is the bullet box

16.1

17console console, the meaning of log log

17.1

18 Use the prompt to get the information entered by the user in the pop-up box 

 

18.1

19 Use of Variables

What is the meaning of the birth of variables? The most valuable thing on a website is user information. How do I store your mobile phone number? I use variables. I know your mobile phone number. Variables are storage data box

Variables store data

19.1

20 let can declare variables

20.1

##

21. Declare a variable

21.1

22 use one = give 18 to age

22.1

23 18 is called a numeric literal

 The console successfully outputs 18

 Other variable declaration cases

23.1

24 Note that the sub-file format can be used. If you want to change the variable value, you can pass =, but you cannot add let 

24.1

25 Declare multiple variables at one time and divide them

25.1

26 Use variables to store data stored by prompt users

26.1

27 How to swap the values ​​of variables

27.1 Procedure for interacting variables

 27.2 The first step is to declare three variables

28 JavaScript is to give the right to the left

28.1

29 First give the value of num1 to temp, then give the value of num2 to num1, and then give the value of temp to num2

29.1

30 There will be several G memory sticks in the computer, there are 4G, there are 8G

30.1

31. The hard disk is external memory, 500T, or other. If you want to save a lot of cost, energy is also a cost. The essence of the variable is to apply for the space for storing data from the memory stick.

31.1

32 Variable naming rules, there are only two kinds of symbols_underscore and knife which symbol

32.1

33 The name must be meaningful

33.1

34 Variable name specification, pay attention, numbers cannot start with

34.1

35 1. The difference between let and var, let can be pre-declared, var is an old version, javascript you can use var to declare variables

 

35.1

36 The meaning of the birth of the array, I want to save the names of 50 classmates at a time, how to save, the array is born

36.1

37 Each array is separated by

37.1

38 Array storage case

38.1 Our array numbers start from zero

39 Using array methods

39.1 Elements, subscripts, numbers

40 mind map is very good

40.1

41. JavaScript can be used to write constants, constant use cases

41.1

42 Java Script data type, numeric number, including decimals

42.1

43 The data type of Java script has priority, () can increase the priority,

43.1

44 How to write the mathematical formula πr square of the area, the original r square is twice multiplied by r

44.1

45 string type, backtick

45.1

46 bug, if you really want to add double quotes inside, use outer single inner double, or outer double inner single

46.1

47 \ Escape character, when you see this symbol, it will print normally for you, use + to splice the string

47.1

48 Use + to concatenate strings

48.1

49 Template strings, when you use strings for splicing, you will find that the bugs in it look too messy, use a knife {} to define variables

49.1

50 Examples of Using Template Strings

50.1

51. Enter your age, and the page will display the entered data 

51.1

52. Boolean data

52.1

53 Print undefind in case of no assignment 

53.1

54 Use typeof to check the data type

54.1

55 In our form, the default is to take the string

55.1

56 There is a risk here. The data fed back in the form is string type data. If you want to add it, it will be game over. If these two are wages, it will be even more game over.

56.1

57 + As long as there is a string next to it, it can be converted to a string

57.1

58 + positive characters, numbers blue, characters black

58.1

59 + also has a function, which can be converted into a digital type

59.1

60 operation rules

60.1

61. As long as there is a string with a + sign, there will be no problem

61.1

62 display conversion, you tell what type the string is converted to

 

62.1

63 Examples of converting to data types

 

Guess you like

Origin blog.csdn.net/weixin_54048131/article/details/132130991