Hi everyone,
I am reading Javascript the good parts and came across this that I
don't understand:
Function.protot ype.method = function ( name, func ) {
this.prototype[name] = func;
return this;
};
Number.method(' integer' , function() {
return Math[this < 0 ? 'ceiling' : 'floor'](this);
});
My question is: what the hell is Function.protot ype.method doing?
2nd What the hell is Number doing?
Why do we have to go Function.protot ype.method instead of just
Function.method ? What does the prototype serve here?
I am reading Javascript the good parts and came across this that I
don't understand:
Function.protot ype.method = function ( name, func ) {
this.prototype[name] = func;
return this;
};
Number.method(' integer' , function() {
return Math[this < 0 ? 'ceiling' : 'floor'](this);
});
My question is: what the hell is Function.protot ype.method doing?
2nd What the hell is Number doing?
Why do we have to go Function.protot ype.method instead of just
Function.method ? What does the prototype serve here?
Comment