I have an example class that has two properties: a variable and an object:
var Animal, a, b;
Animal = (function() {
  function Animal() {}
  Animal.prototype.priceb = 4;
  Animal.prototype.price = {
    test: 4
  };
  Animal.prototype.increasePrice = function() {
    this.price.test++;
    return this.priceb++;
  };
  return Animal;
})();
a = new Animal();
console.log(a.price.test, a.priceb); // 4,4
b = new Animal();
console.log(b.price.test, b.priceb); // 4,4
b.increasePrice();
console.log(b.price.test, b.priceb); // 5,5
console.log(a.price.test, a.priceb); // 5,4 !! not what I would expect. Why not 4,4?
For some reason, this seems to have a weird behavior. It looks like the class stores a reference to the object, so that it is shared across multiple instances.
How can I prevent that from happening?
 
    