| PI | ใช้แสดงค่า PIE ซึ่งเท่ากับ 3.141592653589793 |
|---|---|
| E | ใช้แสดงค่าคงที่ของ Euler ซึ่งเท่ากับ 2.718281828459045 |
| LN2 | ใช้แสดงค่า Logarithm ของ 2 ซึ่งเท่ากับ 0.6931471805599453 |
| LN10 | ใช้แสดงค่า Logarithm ของ 10 ซึ่งเท่ากับ 2.302585092994046 |
| LOG2E | ใช้แสดงค่า Logarithm ฐาน 2 ของ E ซึ่งเท่ากับ 1.4426950408889633 |
| LOG10E | ใช้แสดงค่า Logarithm ฐาน 10 ของ E ซึ่งเท่ากับ 0.4342944819032518 |
| SQRT1_2 | ใช้แสดงค่ารากที่ 2 ของ 1 / 2 ซึ่งเท่ากับ 0.7071067811865476 |
| SQRT2 | ใช้แสดงค่ารากที่ 2 ซึ่งเท่ากับ 1.4142135623730951 |
| abs() | ใช้หาค่าสัมบูรณ์ |
| sqrt() | ใช้หาค่ารากที่สอง |
| pow() | ใช้หาค่ายกกำลัง |
| exp() | ใช้หาค่ายกกำลังของ E |
| random() | ใช้สุ่มตัวเลข โดยจะได้ค่าระหว่าง 0 ถึง 1 |
| round() | ใช้ปัดเศษทศนิยมของเลขที่กำหนด |
| ceil() | ใช้ปัดเศษทศนิยมให้เป็นเลขจำนวนเต็ม และให้มีค่ามากขึ้น |
| floor() | ใช้ปัดเศษทศนิยมให้เป็นเลขจำนวนเต็ม และให้มีค่าน้อยลง |
| max() | ใช้หาค่าค่าที่มากกว่าระหว่างตัวเลขที่กำหนด |
| min() | ใช้หาค่าค่าที่น้อยกว่าระหว่างตัวเลขที่กำหนด |
| log() | ใช้หาค่า logarithm |
| sin() | ใช้หาค่า sine ของมุมที่กำหนด |
| cos() | ใช้หาค่า cosine ของมุมที่กำหนด |
| tan() | ใช้หาค่า tan ของมุมที่กำหนด |
| asin() | ใช้หาค่า arc sine ของตัวเลขที่กำหนด |
| acos() | ใช้หาค่า arc cosine ของตัวเลขที่กำหนด |
| atan() | ใช้หาค่า arc tangent ของตัวเลขที่กำหนด |
| atan2() | ใช้หาค่ามุมพิกัดโพลาร์ ของพิกัด x และ y |
property:PI;
return type:number
content:ใช้แสดงค่า PIE ซึ่งเท่ากับ 3.141592653589793
example:alert ( Math.PI );
property:E;
return type:number
content:ใช้แสดงค่าคงที่ของ Euler ซึ่งเท่ากับ 2.718281828459045
example:alert ( Math.E );
property:LN2;
return type:number
content:ใช้แสดงค่า Logarithm ของ 2 ซึ่งเท่ากับ 0.6931471805599453
example:alert ( Math.LN2 );
property:LN10;
return type:number
content:ใช้แสดงค่า Logarithm ของ 10 ซึ่งเท่ากับ 2.302585092994046
example:alert ( Math.LN10 );
property:LOG2E;
return type:number
content:ใช้แสดงค่า Logarithm ฐาน 2 ของ E ซึ่งเท่ากับ 1.4426950408889633
example:alert ( Math.LOG2E );
property:LOG10E;
return type:number
content:ใช้แสดงค่า Logarithm ฐาน 10 ของ E ซึ่งเท่ากับ 0.4342944819032518
example:alert ( Math.LOG10E );
property:SQRT1_2;
return type:number
content:ใช้แสดงค่ารากที่ 2 ของ 1 / 2 ซึ่งเท่ากับ 0.7071067811865476
example:alert ( Math.SQRT1_2 );
property:SQRT2;
return type:number
content:ใช้แสดงค่ารากที่ 2 ซึ่งเท่ากับ 1.4142135623730951
example:alert ( Math.SQRT2 );
method:abs ( num );
return type:number
content:ใช้หาค่าสัมบูรณ์
example:alert ( Math.abs ( -10 ) );
method:sqrt ( num );
return type:number
content:ใช้หาค่ารากที่สอง
example:alert ( Math.sqrt ( 25 ) );
method:pow ( base, exp );
return type:number
content:ใช้หาค่ายกกำลัง ( base ยกกำลัง exp )
example:alert ( Math.pow ( 3, 4 ) );
method:exp ( num );
return type:number
content:ใช้หาค่ายกกำลังของ E ( E ยกกำลัง num )
example:alert ( Math.exp ( 5 ) );
method:random ();
return type:number
content:ใช้สุ่มตัวเลข โดยจะได้ค่าระหว่าง 0 ถึง 1
example:alert ( Math.random () );
method:round ( num );
return type:number
content:ใช้ปัดเศษทศนิยมของเลขที่กำหนด ( น้อยกว่าหรือเท่ากับ 4 ปัดลง และมากกว่าหรือเท่ากับ 5 ปัดขึ้น )
example:alert ( Math.round ( 2.4 ) );
method:ceil ( num );
return type:number
content:ใช้ปัดเศษทศนิยมให้เป็นเลขจำนวนเต็ม และให้มีค่ามากขึ้น
example:alert ( Math.ceil ( 2.4432 ) );
method:floor ( num );
return type:number
content:ใช้ปัดเศษทศนิยมให้เป็นเลขจำนวนเต็ม และให้มีค่าน้อยลง
example:alert ( Math.floor ( 2.4432 ) );
method:max ( num1, num2 );
return type:number
content:ใช้หาค่าค่าที่มากกว่าระหว่างตัวเลขที่กำหนด
example:alert ( Math.max ( 10, 15 ) );
method:min ( num1, num2 );
return type:number
content:ใช้หาค่าค่าที่น้อยกว่าระหว่างตัวเลขที่กำหนด
example:alert ( Math.min ( 10, 15 ) );
method:log ( num );
return type:number
content:ใช้หาค่า logarithm
example:alert ( Math.log ( 10 ) );
method:sin ( num );
return type:number
content:ใช้หาค่า sine ของมุมที่กำหนด
example:alert ( Math.sin ( 45 ) );
method:cos ( num );
return type:number
content:ใช้หาค่า cosine ของมุมที่กำหนด
example:alert ( Math.cos ( 30 ) );
method:tan ( num );
return type:number
content:ใช้หาค่า tan ของมุมที่กำหนด
example:alert ( Math.tan ( 90 ) );
method:asin ( num );
return type:number
content:ใช้หาค่า arc sine ของตัวเลขที่กำหนด
example:alert ( Math.asin ( 3.45 ) );
method:acos ( num );
return type:number
content:ใช้หาค่า arc cosine ของตัวเลขที่กำหนด
example:alert ( Math.acos ( 0.25 ) );
method:atan ( num );
return type:number
content:ใช้หาค่า arc tangent ของตัวเลขที่กำหนด
example:alert ( Math.atan ( 0.75 ) );
method:atan2 ( x, y );
return type:number
content:ใช้หาค่ามุมพิกัดโพลาร์ ของพิกัด x และ y
example:alert ( Math.atan2 ( 3, 4 ) );