Math
is a built-in object in JavaScript that contains different methods and properties used to perform mathematical operations. It contains the log10()
function, which is used to compute the base 10 logarithm of a specified number.
Math.log10(param);
param
: This is the input value of type Number
for which we want to find the log10()
.
Number
in JavaScript is a 64-bit double-precision value that is the same asdouble
in C# or Java.
Number
: It returns the base 10 logarithm of the input parameter param
. It is of type Number
.
-Infinity
: The function returns this if the input parameter param
= 0.
+Infinity
: The function returns this if the input parameter param
= +Infinity
.
NaN
: The function returns this if the input parameter param
< 0 or param
= -Infinity
.
console.log("log10(-1) = " + Math.log10(-1));console.log("log10(0) = " + Math.log10(0));console.log("log10(1) = " + Math.log10(1));console.log("log10(20) = " + Math.log10(20));console.log("log10(∞) = " + Math.log10(Infinity));console.log("log10(-∞) = " + Math.log10(-Infinity));