function?Math(){};
成都創(chuàng)新互聯(lián)公司自2013年起,先為橫縣等服務建站,橫縣等地企業(yè),進行企業(yè)商務咨詢服務。為橫縣企業(yè)網(wǎng)站制作PC+手機+微官網(wǎng)三網(wǎng)同步一站式服務解決您的所有建站問題。
Math.prototype=new?Object();
/**
*?Property?E
*?@memberOf?Math
*?@since???Standard?ECMA-262?3rd.?Edition?
*?@since???Level?2?Document?Object?Model?Core?Definition.????
*/
Math.E=0;
/**
*?Property?LN10
*?@memberOf?Math
*?@since???Standard?ECMA-262?3rd.?Edition?
*?@since???Level?2?Document?Object?Model?Core?Definition.????
*/
Math.LN10=0;
/**
*?Property?LN2
*?@memberOf?Math
*?@since???Standard?ECMA-262?3rd.?Edition?
*?@since???Level?2?Document?Object?Model?Core?Definition.
*/
Math.LN2=0;
/**
*?Property?LOG2E
*?@memberOf?Math
*?@since???Standard?ECMA-262?3rd.?Edition?
*?@since???Level?2?Document?Object?Model?Core?Definition.????
*/
Math.LOG2E=0;
/**
*?Property?LOG10E
*?@memberOf?Math
*?@since???Standard?ECMA-262?3rd.?Edition?
*?@since???Level?2?Document?Object?Model?Core?Definition.?
*/
Math.LOG10E=0;
/**
*?Property?PI
*?@memberOf?Math
*?@since???Standard?ECMA-262?3rd.?Edition?
*?@since???Level?2?Document?Object?Model?Core?Definition.??
*/
Math.PI=0;
/**
*?Property?SQRT1_2
*?@memberOf?Math
*?@since???Standard?ECMA-262?3rd.?Edition?
*?@since???Level?2?Document?Object?Model?Core?Definition.????
*/
Math.SQRT1_2=0;
/**
*?Property?SQRT2
*?@memberOf?Math
*?@since???Standard?ECMA-262?3rd.?Edition?
*?@since???Level?2?Document?Object?Model?Core?Definition.?
*/
Math.SQRT2=0;
/**
*?function?abs(x)
*?@memberOf?Math
*?@param?{Number}?x
*?@type?Number
*?@returns?{Number}
*?@since???Standard?ECMA-262?3rd.?Edition?
*?@since???Level?2?Document?Object?Model?Core?Definition.?????
*/
Math.abs=function(x){return?0;};
/**
*?function?acos(x)
*?@memberOf?Math
*?@param?{Number}?x
*?@type?Number
*?@returns?{Number}
*?@since???Standard?ECMA-262?3rd.?Edition?
*?@since???Level?2?Document?Object?Model?Core?Definition.
*/
Math.acos=function(x){return?0;};
/**
*?function?asin(x)
*?@memberOf?Math
*?@param?{Number}?x
*?@type?Number
*?@returns?{Number}
*?@since???Standard?ECMA-262?3rd.?Edition?
*?@since???Level?2?Document?Object?Model?Core?Definition.??
*/
Math.asin=function(x){return?0;};
/**
*?function?atan(x)
*?@memberOf?Math
*?@param?{Number}?x
*?@type?Number
*?@returns?{Number}
*?@since???Standard?ECMA-262?3rd.?Edition?
*?@since???Level?2?Document?Object?Model?Core?Definition.
*/
Math.atan=function(x){return?0;};
/**
*?function?atan2(x,y)
*?@memberOf?Math
*?@param?{Number}?x
*?@param?{Number}?y
*?@type?Number
*?@returns?{Number}
*?@since???Standard?ECMA-262?3rd.?Edition?
*?@since???Level?2?Document?Object?Model?Core?Definition.??
*/
Math.atan2=function(x,y){return?0;};
/**
*?function?ceil(x)
*?@memberOf?Math
*?@param?{Number}?x
*?@type?Number
*?@returns?{Number}
*?@since???Standard?ECMA-262?3rd.?Edition?
*?@since???Level?2?Document?Object?Model?Core?Definition.????
*/
Math.ceil=function(x){return?0;};
/**
*?function?cos(x)
*?@memberOf?Math
*?@param?{Number}?x
*?@type?Number
*?@returns?{Number}
*?@since???Standard?ECMA-262?3rd.?Edition?
*?@since???Level?2?Document?Object?Model?Core?Definition.??
*/
Math.cos=function(x){return?0;};
/**
*?function?exp(x)
*?@memberOf?Math
*?@param?{Number}?x
*?@type?Number
*?@returns?{Number}
*?@since???Standard?ECMA-262?3rd.?Edition?
*?@since???Level?2?Document?Object?Model?Core?Definition.?
*/
Math.exp=function(x){return?0;};
/**
*?function?floor(x)
*?@memberOf?Math
*?@param?{Number}?x
*?@type?Number
*?@returns?{Number}
*?@since???Standard?ECMA-262?3rd.?Edition?
*?@since???Level?2?Document?Object?Model?Core?Definition.??
*/
Math.floor=function(x){return?0;};
/**
*?function?log(x)
*?@memberOf?Math
*?@param?{Number}?x
*?@type?Number
*?@returns?{Number}
*?@since???Standard?ECMA-262?3rd.?Edition?
*?@since???Level?2?Document?Object?Model?Core?Definition.????
*/
Math.log=function(x){return?0;};
/**
*?function?max(arg)
*?@memberOf?Math
*?@param?{Number}?args
*?@type?Number
*?@returns?{Number}
*?@since???Standard?ECMA-262?3rd.?Edition?
*?@since???Level?2?Document?Object?Model?Core?Definition.??
*/
Math.max=function(args){return?0;};
/**
*?function?min(arg)
*?@memberOf?Math
*?@param?{Number}?args
*?@type?Number
*?@returns?{Number}
*?@since???Standard?ECMA-262?3rd.?Edition?
*?@since???Level?2?Document?Object?Model?Core?Definition.????
*/
Math.min=function(args){return?0;};
/**
*?function?pow(x,y)
*?@memberOf?Math
*?@param?{Number}?x
*?@param?{Number}?y
*?@type?Number
*?@returns?{Number}
*?@since???Standard?ECMA-262?3rd.?Edition?
*?@since???Level?2?Document?Object?Model?Core?Definition.????
*/
Math.pow=function(x,y){return?0;};
/**
*?function?pow()
*?@memberOf?Math
*?@type?Number
*?@returns?{Number}
*?@since???Standard?ECMA-262?3rd.?Edition?
*?@since???Level?2?Document?Object?Model?Core?Definition.?????
*/
Math.random=function(){return?0;};
/**
*?function?round(x)
*?@memberOf?Math
*?@param?{Number}?x
*?@type?Number
*?@returns?{Number}
*?@since???Standard?ECMA-262?3rd.?Edition?
*?@since???Level?2?Document?Object?Model?Core?Definition.???
*/
Math.round=function(x){return?0;};
/**
*?function?sin(x)
*?@memberOf?Math
*?@param?{Number}?x
*?@type?Number
*?@returns?{Number}
*?@since???Standard?ECMA-262?3rd.?Edition?
*?@since???Level?2?Document?Object?Model?Core?Definition.????
*/
Math.sin=function(x){return?0;};
/**
*?function?sqrt(x)
*?@memberOf?Math
*?@param?{Number}?x
*?@type?Number
*?@returns?{Number}
*?@since???Standard?ECMA-262?3rd.?Edition?
*?@since???Level?2?Document?Object?Model?Core?Definition.?????
*/
Math.sqrt=function(x){return?0;};
/**
*?function?tan(x)
*?@memberOf?Math
*?@param?{Number}?x
*?@type?Number
*?@returns?{Number}
*?@since???Standard?ECMA-262?3rd.?Edition?
*?@since???Level?2?Document?Object?Model?Core?Definition.????
*/
Math.tan=function(x){return?0;};
肯定是有一點關系的 但是涉及的知識點不大 簡單的函數(shù)寫多了就會理解 有些復雜的直接調用就可以了
JS中Math函數(shù)的常用方法
Math是數(shù)學函數(shù),但又屬于對象數(shù)據(jù)類型typeof Math= ‘object’
console.dir(Math)查看Math的所有函數(shù)方法。
1,Math.abs()獲取絕對值
Math.abs(-12) = 12
2,Math.ceil() and Math.floor()向上取整和向下取整
console.log(Math.ceil(12.03));//13
console.log(Math.ceil(12.92));//13
console.log(Math.floor(12.3));//12
console.log(Math.floor(12.9));//12
3,Math.round()四舍五入
注意:正數(shù)時,包含5是向上取整,負數(shù)時包含5是向下取整。
1、Math.round(-16.3) = -16
2、Math.round(-16.5) = -16
3、Math.round(-16.51) = -17
4,Math.random()取[0,1)的隨機小數(shù)
案例1:獲取[0,10]的隨機整數(shù)
console.log(parseInt(Math.random()*10));//未包含10
console.log(parseInt(Math.random()*10+1));//包含10
案例2:獲取[n,m]之間的隨機整數(shù)
Math.round(Math.random()*(m-n)+n)
5,Math.max() and Max.min()獲取一組數(shù)據(jù)中的最大值和最小值
console.log(Math.max(10,1,9,100,200,45,78));
console.log(Math.min(10,1,9,100,200,45,78));
6,Math.PI獲取圓周率π 的值
console.log(Math.PI);
7,Math.pow() and Math.sqrt()
Math.pow()獲取一個值的多少次冪
Math.sqrt()對數(shù)值開方
Math.pow(10,2) = 100;
Math.sqrt(100) = 10;