- Js data type is divided into two kinds:
- Original value (Number String undefined null) data which is the stack
- If the value of the original value of a a b to another, if you change a value, but the value of b will not change
because when the value of a is assigned to b, in fact, is to copy the data a to b, they ; two of the data is the same, but their addresses are not the same
- If the value of the original value of a a b to another, if you change a value, but the value of b will not change
- Reference value (array Object function ... data RegExp) which is heap data
- If the original value of a value of a b to another, if the value of a change, but also becomes the value of b
as the value of a to b, while, in fact, is directly assigned to the address a data b, so a and b are the same address now points to the data, when a or b in time for a change, a and b are changing
, however, if after a value assigned to b, and a re-assignment to yourself, now a and b is not the same, because the re-assignment gave himself opened a new address (memory)
- If the original value of a value of a b to another, if the value of a change, but also becomes the value of b
- Original value (Number String undefined null) data which is the stack
- Any type of data strings are equal to the string plus
-
var a = c && d or var a = c || d
we call returns true or false They are converted
js the bottom of those things
Guess you like
Origin www.cnblogs.com/zhuzhu520/p/11846265.html
Recommended
Ranking