Method for finding logarithms: 1. Use the LN2 attribute and the syntax "Math.LN2" to return the natural logarithm of 2; 2. Use the LN10 attribute and the syntax "Math.LN10"; 3. Use LOG2E Attribute, syntax "Math.LOG2E"; 4. Use log() method, syntax "Math.log(x)".
The operating environment of this tutorial: windows7 system, javascript version 1.8.5, Dell G3 computer.
JavaScript method of finding logarithms:
1. Use the LN2 attribute of the Math object
## The #LN2 attribute is, which returns the natural logarithm of 2 (approximately equal to 0.693), and its value is approximately 0.69314718055994528623.
Syntax:Math.LN2
2. Use the LN10 attribute of the Math object
LN10 attribute is, Returns the natural logarithm of 10 (approximately 2.302), which is approximately 2.3025850929940459011.
Grammar:Math.LN10
3. Use the LOG2E attribute of the Math object
The LOG2E attribute is log2e and can be returned The logarithm of e with base 2 (approximately equal to 1.4426950408889634) Syntax:Math.LOG2E
4. Use the LOG10E attribute of the Math object
LOG10E attribute is, which can return the logarithm of e with base 10 (approximately equal to 0.434).
Grammar:Math.LOG10E
5. Use the log() method of the Math object
log() method can Returns the natural logarithm of a number (based on E). Syntax:Math.log(x)
Math.log(2);
0.6931471805599453
javascript learning tutorial 】
The above is the detailed content of How to find logarithm in JavaScript. For more information, please follow other related articles on the PHP Chinese website!