Been searching for a while to fully understand how arrays works in object. I am familiar with other languages but this causes a lot of confusion for me. Having an object
var Test = {
TestArray: [],
}
var a = Object.create(Test);
var b = Object.create(Test);
From my expectation this should create 2 instances of the object and having 2 different arrays however having an array inside behave like 1 instance adding values to the array affects both instances could anyone explain why?
Testisn't a class, it's an object. All you're doing is creating two objectsaandbwith the same shared prototypeTest.