How to add properties and methods to the Number object in JavaScript

1 Answer

0 votes
Number.prototype.MulMul = function() {
    return this.valueOf() * 2 * 2;
};


var n = 13;
document.write(n.MulMul()); 


/*
run:

52 

*/

 



answered Apr 14, 2017 by avibootz
...