<!DOCTYPE html> <html> <body> <h1>JavaScript 日期</h1> <h2>使用 new Date()</h2> <p>不带参数 的 new Date() 创建了一个具有当前日期和时间的日期对象:</p> <p id="demo"></p> <script> const d = new Date(); document.getElementById("demo").innerHTML = d; </script> </body> </html>