文档:https://developer.mozilla.org/zhCN/docs/Web/JavaScript/Reference/Global_Objects/Math
- Math不是一个构造函数,它的属性和方法都是静态的,不能用prototype来添加属性和方法
- 像String这样的就可以在原型对象添加属性和方法
console.dir(String);
而Math就不行
console.dir(Math);
console.log(Math.prototype);
- 给Math添加属性和方法直接.出来,如:
Math.getInfor=function(){
console.log("这是Math");
};
Math.getInfor();