代码示例:(标识:jsck_log10_1)
<!DOCTYPE html>
<html>
<body>

<p>单击该按钮可显示数字 "2" 的以 10 为底的对数。</p>

<button onclick="myFunction()">试一试</button>

<p id="demo"></p>

<script>
function myFunction() {
  document.getElementById("demo").innerHTML = Math.log10(2);
}
</script>

</body>
</html>
运行结果: