<!DOCTYPE html>
<html>
<body>
<h2>My First JavaScript</h2>
<p id="demo"><script>Date()</script></p> <!-- here I want to put the output of Date() method -->
</body>
</html>
I know that I can do something like:
<button type="button"
onclick="document.getElementById('demo').innerHTML = Date()">
Click me to display Date and Time.</button>
But I'd like to know if there's a way to do that inside the paragraph directly.