<script>
let name = prompt("what is the name?");
document.getElementById('assignmentName').innerHTML = name;
</script>
<div id="assignmentName"></div>
Why does this not work?
<script>
let name = prompt("what is the name?");
document.getElementById('assignmentName').innerHTML = name;
</script>
<div id="assignmentName"></div>
Why does this not work?
<div id="assignmentName"></div>
<script>
let name = prompt("what is the name?");
document.getElementById('assignmentName').innerHTML = name;
console.log(name)
</script>
There are two good ways to include the JavaScript.
<script src="script.js" defer></script> right in front of the closing </body> tag.or
<script src="script.js" defer></script> right in front of the closing </head> tag.In this both cases, defer is forcing the website layout to 100% and run the skript after.