4.3.1. The Method Invocation Pattern
var myObject = {
value: 0;
increment: function (inc) {
//此处的this是对象本身
this.value += typeof inc === 'number' ? inc : 1;
}
};
应该是
var myObject = {
value: 0,
increment: function (inc) {
//此处的this是对象本身
this.value += typeof inc === 'number' ? inc : 1;
}
};
4.7. Augmenting Types
Number.method('integer', function ( ) {
return Math[this < 0 ? 'ceiling' : 'floor'](this);
});
应该是
Number.method('integer', function ( ) {
return Math[this < 0 ? 'ceil' : 'floor'](this);
});