GUVI
Back

Loops and iteration

Created 3 years ago
47 Views
2 Comments
VishnuRadhakrishnanO
@VishnuRadhakrishnanO
VishnuRadhakrishnanO
@VishnuRadhakrishnanOProfile is locked. Login

please help me with this.

I have observed that the alert window appeared 6 times instead of 5 times for the below code. Please tell me why its happening.

//html part

<html>

<body>

<script src = "somesample.js">

</script>

<script>

a();

</script>

</body>

</html>

//Js part

function a(){

var b= prompt("Enter the value")

for (var i=0; i<5; i++)

{

alert(b);

}

};

Comments (2)
Please login to comment.
 
Powered by habitate.io Habitate