Apologies if the question seems stupid but I'm relatively new to JS.
I have a class Dog that inherits Animal. Animal has an array property. In the code I create a new Dog and add stuff to the array. The problem is that each new instance of Dog seems to share that array.
Animal.js:
define([
"dojo/_base/declare",
"evo/common/model/_Model"
], function(declare, _Model ) {
return declare([_Model], {
_id: 0,
_items: [],
_filter: null,
...
});
});
Dog.js:
define([
"dojo/_base/declare",
"evo/common/model/_ModelList"
], function (declare, _ModelList) {
return declare([_ModelList], {
...
});
});
I fixed resetting _items when I create a new Dog but I suspect if I had multiple instances of Dog this would affect all. How to make the properties non-static?