Q:

Extracting integer from a number

I recently purchase Javascript the Goods Parts by Douglas Crockford. I was going through the Augmenting Types section and I needed some help in the following code concept.
Number.method("integer", function(){
  return Math[this < 0 ? "ceiling" : "floor"] (this);
});

document.writeIn((-10/3).integer());

According to the book the result should be 3 but I am getting an error while I did console.log instead of document.writeIn.
Number.method is not a function. Being a javascript beginner, I am a bit confused, any help would be appreciated.
Thank You. 
Udit G.

A:

he defined the function "method" on another occasion. it is not part of the standard.
an example is here http://www.crockford.com/javascript/inheritance.html#sugar
Function.prototype.method = function (name, func) {
    this.prototype[name] = func;
    return this;
};

you just should tie it to Object or Number instead of Function as in the link.

