Please see the fiddle/code below: http://jsfiddle.net/kmiklas/3YdTA/4/
Questions:
- Why does a call to the setter function of a child--in the example, the call to Object.create(99)--change the setting of the parent? Note how, although we've invoked this function in the context of orange, it's also changing the value for red.
- More importantly, how can inherited getter/setter functions be applied to the child, and not the parent?
- What am I missing here?
var Square = function () {
    var side;
    this.setSide = function(s) {
        side = s
    }
    this.getSide = function() {
        return side;
    }
}
var red = new Square();
var orange = Object.create(red);
red.setSide(100);
var $container = $('#container');
$container.append('orange.getSide(): ' + orange.getSide() + '<br>');
$container.append('red.getSide(): ' + red.getSide() + '</br><br>');
$container.append('<i>Now we call orange.setSide(99)...</i><br></br>');
orange.setSide(99);
$container.append('orange.getSide(): ' + orange.getSide() + ' <i>...as expected.<br></i>');
$container.append('red.getSide(): ' + red.getSide() + '!? <i>Why does the call to orange.setSide(99) affect the side length of the parent?</i></br>');
 
     
    