Today #day38 of #100daysofcode, I have completed 6.41 lesson and a code practice problem in JS course. @Sololearn
core objects
The math object
- The Math object allows you to perform mathematical tasks, and includes several properties.
- Math.E -> euler's constant
- Math.LN2 -> natural log of value 2
- Math.Log2E -> base 2 log of euler's constant
- Math.PI -> returns the constant Pi
- Math has no constructor. There's no need to create a Math object first.
Math Object Methods
- The Math object contains a number of methods that are used for calculations:
- Math.abs(x) -> returns the absolute value of x.
- Math.pow(x,y) -> returns the value of X to the power of y.
- Math.sqrt(x) -> returns the value of square root of x.
Code: click
- it is annoying to get another prompt or alert after clicking the cancel first prompt , so I have modified the code do not ask if user click cancel,
Code: click
- Math is a handy object
Images
- 6.41 completed
Conclusion
- The math object
- Math Object Methods
- Quiz
- code
My Code:
- Century program problem