Skip to content

Commit 37e19d2

Browse files
committed
[Add] basic introduction to Math
1 parent 309f4e0 commit 37e19d2

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// 01_basic.js
2+
/*
3+
Math is a built-in object that provides properties and methods for mathematical operations. It is a global object and is available in all JavaScript environments without the need to create an instance.
4+
5+
Properties:
6+
The Math object has several properties that represent mathematical constants and values. Some examples include Math.PI, which represents the mathematical constant pi, and Math.E, which represents the base of the natural logarithm, approximately equal to 2.71828.
7+
8+
Methods:
9+
The Math object provides various methods for performing mathematical operations. Some commonly used methods include Math.abs(), which returns the absolute value of a number, Math.round(), which rounds a number to the nearest integer, and Math.random(), which generates a random number between 0 (inclusive) and 1 (exclusive).
10+
11+
Mathematical Functions:
12+
The Math object also provides methods for various mathematical functions, such as Math.sqrt() for calculating the square root, Math.pow() for raising a number to a power, Math.sin(), Math.cos(), Math.tan(), Math.asin(), Math.acos(), Math.atan(), and more.
13+
*/
14+
console.log("Math.LN10: " + Math.LN10);
15+
console.log("Math.LOG2E: " + Math.LOG2E);
16+
console.log("Math.Log10E: " + Math.LOG10E);
17+
console.log("Math.SQRT2: " + Math.SQRT2);
18+
console.log("Math.SQRT1_2: " + Math.SQRT1_2);
19+
console.log("Math.LN2: " + Math.LN2);
20+
console.log("Math.E: " + Math.E);
21+
console.log("Math.PI: " + Math.PI);

0 commit comments

Comments
 (0)