js basis

js: javascript shorthand, is a scripting language. 

js manner of introduction:
external style: <script src = ""> </ script>
Internal Style: <script> </ script> <- - in this typing!>
inline style: <div onclick = "alert (1); "> </ div>

statement required end identifier;

variables: literal meaning: the amount can vary, literally: a container for storing data

declaration method: var
direct assignment of direct assignment, the assignment can not be directly ascribed to an initial value, and the contents of the initial value of the future is the data type of the assignment of the underlying value

variable naming: keywords and reserved words can not be used as a variable
composition variables: English, numbers, underscore, $ (NOTE: the numbers can not be used as a variable the first letter of the name)
writing:
Hungarian notation: the first to write several types of abbreviations, write the name.
Hump nomenclature:
Big Hump: capitalize the first letter of each word.
Small hump: capitalize the first letter of each word, except the first word lowercase letters
when writing the name: the first verb noun
verb, get: get
the term, set: set

Note:
HTML comments: <! - ->


Single-line comments: // ctrl + /
multi-line comments: / * * / ctrl + shift + /

detection data types: typeof

data types:
basic types: digital number, string string, boolean boolean, null, undefined
reference Type: Array array, the object object, function function

memory:
heap ----> basic types ----> copy of the
stack ----> reference type ----> pointer

memory leaks: after the variables did not recover in time, so that it has been occupied by memory, the cause memory to become wild memory
consequences: Caton browser's

memory pollution: due to the variable named the same name conflict
consequences: generating bug

out of memory: data stored in the variable size exceeds the size of pre-allocated memory
consequences: stuck up

garbage recovery mechanisms: the memory used by the timely recovery
flag clear: making a mark at the end of the variable = null use
reference counting: determined by using a variable frequency and whether
(when a variable is declared and a reference type is assigned to the variable the number of citations, then this value is 1,
the contrary, if the value of this variable contains references to another interesting Outside a value, then the number of values used to
subtract 1 when the number of references becomes 0, it will release those reference number 0 occupied memory.)
<Script>
/ *
* function block
* function: a meaning of each parameter
* meaning of each parameter b
* c meaning of each parameter of the
* /


/ *
*
* basic types: typeof
* Digital Number
* string String
* Boolean Boolean
* Object null
* undefined undefined
* var. 1 = A
* A typeof // Number
* var B = null;
* B // === null detects whether null null
*
* reference types: the instanceof
* array array
* Object Object
* function function
* B = var ()
* B the instanceof Object to true //
*
* * /
var C = function () {};
the console.log (the instanceof function C)
</ Script>

Guess you like

Origin www.cnblogs.com/xiewangfei123/p/12026847.html