Here's the full code and it works:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Last Modified Property in JS</title>
</head>
<body>
<section>
<h1>The lastModified Property</h1>
</section>
<footer>
<p>This document was last modified:</p>
<p id="demo"></p>
<script>
let text = document.lastModified;
document.getElementById("demo").innerHTML = text;
</script>
</footer>
</body>
</html>