Showing posts with label Do While. Show all posts
Showing posts with label Do While. Show all posts

For Loop using inside of Do While Loop Using in Javascript

for Loop using inside of Do While Loop Using in Javascript 


for loop using inside of the do while loop  in JavaScript.

                       DEMO

           

Javascript Coding

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>for Loop using inside of Do While Loop Using in Javascript </title>
    <script type="text/javascript">       
        do
        {
            var choice = Number(prompt("Enter the Number:"));
            if(isNaN(choice))
            {
                alert('Not a Number');
            }
        }
        while (isNaN(choice))
        {
            for (var i = 0; i < choice; i++)
            {
                document.write(i + "</br>");
               
            }
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:Label ID="Label1" runat="server" ForeColor="red" Text=""></asp:Label>
    </div>
    </form>
</body>
</html>


Do While Loop Using in Javascript

Do While Loop Using in Javascript

Do while loop at least  once execute 
Do While loop  if  do condition correct after go to while

                       DEMO

         

            Javascript Coding


<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Do While Loop Using in Javascript </title>
    <script type="text/javascript">       
        do
        {
            var choice = prompt("Enter Yes or No?");
            if(choice !="Yes" && choice != "No")
            {
                alert('InValid Choice');
            }
        }
        while (choice!="Yes" && choice!="No")
        {
            alert('Valid Choice');
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
   
    </div>
    </form>
</body>
</html>