REFERENCE SYSTEM IN JAVASCRIPT
Let us dive into the reference system in javascript, take a look at this code
var object1 = {value : 10 };
var object2 = object
var object 3 = {value :10 }
object1 === object3 -------false
object2 === object 1 ------- TRUE
value.object3---------------- 10
value.object1 --------------- 10
[]===[]------------------------false
why is the so? well according to ECMA, the official body governing JavaScript. The standard object created by this body are numbers, strings, Boolean, undefined, null. As software engineers, we create our own custom object as we program, for example, value:10 these objects are stored in the "box-like" compartment
Object 1 stores a value 10 in a particular "box-like" data structure, and also stating that object2 = object1 . This two object has been stored in the same box, which makes object1 === object2 True because they are stored in the same compartment or box . Object1 has a value of 10, so also those object3 , running Object1=object3 will be false why? When you create an object1 it is stored in its own box, same as object3 , Object 3 and Object1 are both in different boxes or reference. [] === [] this is false , because both arrays are different boxes or compartment