Identifier naming rules: the first character must start with a letter, underscore-, dollar sign, and can be followed by letters, underscore-, numbers' dollar sign
The scope of variables: global variables and local variables = "global declaration outside the function, local vice versa;
<script language="javascript">
var a; //The variable is declared outside the function and acts on the entire script code
function send()
{ a="JavaScript" var b="Language basics" //The variable is declared inside the function , Only works on the function body alert(a+b); }
</script>
Variable lifetime: 2 types of global and local variables = "global until the end of the program = "local until the end of the function;
2 Data type
Integer ()', floating point (flort), string (string), boolean (), undefined (undefined=>var=a or var=string notProperty;)
NaN is not a number, (null)
Assignment operation: For example: a+=b=> is equivalent to a=a+b; String operation: concatenate a string=" "name" + "study",
Boolean operators
effect
|
C
|
Pascal
|
equal
|
==
|
=
|
not equal to
|
!=
|
<>
|
Less than
|
<
|
<
|
more than the
|
>
|
>
|
Less than or equal to
|
<=
|
<=
|
greater or equal to
|
>=
|
>=
|
versus
|
&&
|
and
|
or
|
||
|
or
|
non-
|
!
|
not
|
XOR
|
^
|
xor
|
Ternary operator (condition)? :
The typeof operator operator returns the type of data currently contained in its operand. This is especially useful for judging whether a variable has been defined
new operator: create a new object