Get your own website Result Size: 625 x 565
x
 
<!DOCTYPE html>
<html>
<body>
<h1>The Document Object</h1>
<h2>The scripts Property</h2>
<script>
document.write("Hello World!");
</script>
<p>return the contents of the script element with id="myScript":</p>
<p id="demo"></p>
<script id="myScript">
let text = document.scripts.namedItem("myScript").text;
document.getElementById("demo").innerHTML = text;
</script>
</body>
</html>