date () object:
the Date object is used to process dates and times.
1.1
Math Object
Math.ceil () the ceiling function rounded up to take integers, not enough to enter 1
Math.floor () floor function give away decimals
Math.max ()
math.min ()
Math.pow ()
Math.Round ()
math.random ()
Data type Conversions
numeric type to string
String ()
variable . toString ()
string to numeric type
Number
★ Numeric Type of string, after conversion to get the number.
★ Non-numeric string, after conversion to get is NaN.
★ Decimal type of string, after conversion to get the original number.
parseint
★ Integer numeric type of string, converted to get an integer number.
★ The string at the beginning of the number, which is the number in front of the conversion.
★ A string that starts with a non-digit, and the conversion is NaN.
★ Decimal type of string, converted after rounding.
parsefloat
★ Integer numeric type of string, converted to get an integer number.
★ The string at the beginning of the number, which is the number in front of the conversion.
★ A string that starts with a non-digit, and the conversion is NaN.
★ Decimal type of string, after conversion to get the original number.
Turn Boolean type
Boolean ()
★ The number and string are trueafter the turn is complete.
★undefined,null,0 turns to false after completion .
implicit data-type conversions
In the process of operation, the program's own data conversion ( programmer does not operate )
logical Operators
The logical operation has only 2 results, one is true and one is false.
and &&
★ Two when the expression is true , the result is true.
or | |
★ As long as there is an expression of true, the result is true.
Non-
★ The opposite result of the expression.
equals operator
"=" Assignment operator
the "= =" only determines whether the content is the same and does not determine the data type.
"= = =" Not only judge the content, but also determine whether the data type is the same.
! = Determines whether the content is not the same and does not determine the data type.
! = = not all equals not only to determine whether the content is not the same, but also to determine whether the data type is not the same.
Collective declaration of variables
if...else condition judgment
IF (conditional expression) {
if the conditional expression evaluates to True, the code is executed. If the conditional expression result is false, the code below executes.
}else{
if the conditional expression result is false, the code is executed.
}
If Else nesting
IF (conditional expression) {
if the conditional expression evaluates to True, the code is executed. The code below does not execute. If False, the code below is executed.
}else If (conditional expression) {
if the conditional expression evaluates to True, the code is executed. The code below does not execute. If False, the code below is executed.
}else if (conditional expression) {Executes the code if the condition expression evaluates to True. The code below does not execute. If False, the code below is executed.
}else{
if the upper condition expression evaluates to false, the code is executed.
}
Three -dimensional expression
An expression ? Results 1 : Results 2 ;
If the expression evaluates to true, execution results 1, and if the expression evaluates to false, the result 2 is executed.
can be understood as another way of writing if else.
Code debugging
Let the program run through it first
F12 code Debugging Tools
Refresh Page
Find step-by-step debugging, one step at a time, every click.
Add a variable or an expression to the Watch window.
Select the variable or expression right-click Add to watch.
Watch Window
javascript.02--Data