1.//declares a variable, JS is a weakly typed language, and the variable type is explicitly meaningless. Variable types can be changed at any time.
var a = 1;
A = "haha";
A = false;
2. Comments are the same as Java (//and/**/), but there is no document comment.
3,js each line of statements using ";", can also not add, but it is better to add it.
4. Declaring variables is, or can not add Var, plus var declaration, the scope of the code block, not add is the global scope.
5. Syntactically is case-sensitive.
6.
Classification of variables in Java
* Basic Data type ==>8 (4 integer, 2 floating point, 2 characters)
* Reference Data type
Variable classification in JS:
* Primitive type (simple data stored in stack)
* Object type (objects stored in the pair (heap))
Primitive type ==>5 species
1.number digits, partial integer or floating-point type.
2.string string
3.boolean Boolean
4.null average person is assigned null, placeholder for object type
5.undefined (undefined/uninitialized), a null derivative, usually automatically assigned by the system, when we create a variable, and there is no initialization.
Operator ==>typeof returns the type name of the original type
var a = "Hello";
Alert (typeof a);
typeof null returns an object. This is a JavaScript bug, and later felt very good, it was preserved.
var B = new Object ();
typeof B; This is also the object returned
JS basic syntax and variables