by value (primitive type)
copying the value into two separate spots in memory
by reference (all objects)
no copy of object is created, instead, two names or more point to same address
1 2 3 4 5 6 7 8 9 |
var a = { greeting: 'hello', }; var b = a; a.greeting = 'hola'; b.greeting === 'hola'; //true /* set up a new memory space and point b to if */ b = { greeting: '你好' }; a.greeting != b.greeting; //true |