看过好几遍,总是忘,闷,摘出来,不想抄书打字,找网上电子书,看见个英文版的,就拿来了,顺便对照下,学习下一些专业英文单词好了。

In ECMAScript, a variable can hold one of two types of values: primitive values and reference values(原始值和引用值).
Primitive values are simple pieces of data that are stored on the stack(栈), which is to say that their
value is stored directly in the location that the variable accesses(直接存储在变量的访问位置).
Reference values, on the other hand, are objects that are stored in the heap(堆), meaning that the value
stored in the variable location is a pointer to a location in memory where the object is stored(存储在变量处的值是一个指针,指向存储对象的内存处).

太抽象了,这个是不是这样的?可是下面的是一种描述列子:把a的值给b后,再改变b的值,a的值并没有因为b值的改变而变化,这是值类型的特点:直接存储。那么把a的值给了b,再改变b的值,a的值也跟着改变了。

原因在于,引用值存储的是引用。是指针。当把a这个指针给了b,其实是不是可以理解为复制了一个“连体指针”(息息相关的连体兄弟,我倒,这是我杜撰的)?他们指向的是同一个东西,当改变了b的指示方向,a就跟着变了。