GoodParts .5
JavaScript
var myObject = {
value: 0,
increment: function (inc) {
this.value += typeof inc === 'number' ? inc : 1;
document.writeln('this.value= '+this.value); // 1
}
};
myObject.increment( );
document.writeln(myObject.value +'<br>'); // 1
myObject.increment(2);
document.writeln(myObject.value +'<br>' ); // 3
myObject.increment(3);
document.writeln(myObject.value +'<br>'); // 1