I am a JavaScript beginner. Could someone explain in what order line1, line2 and line3 are executed in my code? I was thinking it should first show the paragraph in the website (line 1), and then show the picture (line 2), and finally make a prompt.
However what happened is that it first shows the paragraph (line 1) and makes a prompt (line 2). After the prompt gets some input the picture is shown. Why is that?
My code is as follows:
<!DOCTYPE html>
<html>
<head>
</head>
<body BGCOLOR = "white">
<p>paragraph 1</p> <!--line 1-->
<img name = "img1" src = "http://vignette2.wikia.nocookie.net/ironman/images/e/e3/Iron_man_the_game_1.jpg/revision/latest?cb=20100520163628"> <!--line 2-->
<script type = "text/javascript">
var index = parseInt(prompt("enter a number",1));//line3
</script>
</body>
</html>