JS three parts of one, Ecmajavascript basic syntax: 1.javascript introduction 1) Inline
<script>
Alert (1)
</script>
2) Introduction Type
<script src= ' test.js ' > </script>
2.javascript Basic Syntax 1) a few simple functions
Alert (), # warning dialog box
Confirm (), # confirmation dialog box
Prompt (), # Input dialog box, received as a string
Config.log () # console output
Config.dir () #
document.write () #
typeof (variable) # type query
Syntax rules: JavaScript for line, indentation, space insensitive, end of statement with a semicolon, single-line comment//Multiline comment/*/
2) Direct volume, variable
(1) Direct Volume: Number 99 and string "99"
(2) Definition, assignment, naming specification of variables
var A;
A = 1;
· Naming conventions for variable names: only English letters, numbers, underscores, dollar sign $, and cannot start with a number, and cannot be a JavaScript reserved word. and case sensitive.
Camel 标记法
The first letter is lowercase, and the next letter begins with an uppercase character. For example:var mytestvalue = 0, Mysecondvalue = "Hi" = 0, Mysecondvalue = "Hi" = 0, Smysecondvalue = "HI";
variable name writing type
3) Data type base data type:
String:
Number:
Number.max_value,number.min_value.
Nan is not equal to Nan
IsNaN (' Test ') #true
Infinity
Boolean:
Null:
Undefined:
Reference data type:
Array: Arrays
String:
Date:
Object:
4) Data type conversion
-
-
- Number + String : Number converted to string
- Number + Boolean: True converts to 1,false to 0
- String + Boolean value : Boolean converted to string true or False
- Convert to String: toString ()
- Convert to Number: parseint ()
- Convert to Floating point: parsefloat ()
- Coercion Type conversions: String (), Boolean (), Number ()
5) Process Control # if () {}else{} # if () {}else if () {}else{} # && | | # while () {} # Do{}while () # for (Var i=0;i<10;i++) {},
# switch (condition) {//Note case penetrating problem
Case 1:
Execute the statement;
Break
Case 2:
Execute the statement;
Break
。。。。。。。。
Default
Execute the statement;
}
Second, Dom three, BOM
Python full stack development day44-js, DOM, BOM