Java Script Example for WHILE Loop

<html >
<head>
<title>JavaScript While Loop</title>
<script type="text/javascript">
var myarray=new Array(5);
myarray[0]="Sonam";
myarray[1]="Jamtsho";
myarray[2]="Karma";
myarray[3]="Phuntsho";
myarray[4]="Tshering";
var name=prompt("Enter a name to search:");
var i=0;
while(i<myarray.length)
  {
   if(name==myarray[i])
     {
      document.write(name+ " is located at position "+(i+1));
      break;
     }
    i++;
  }

</script>
</head>

<body>

</body>
</html>

Comments

Popular posts from this blog

ACTION_FAILED:OU_INVALID: Solution for GoogleApps bulk user upload issue, username@domainname.com:ACTION_FAILED:OU_INVALID. This error is because you have not specified the Org Unit Path properly.

Moodle OAuth 2. This account is pending email confirmation! Solved

[Solved][Proxmox update] Failed to fetch https://enterprise.proxmox.com/debian/pve/dists/buster/InRelease 401 Unauthorized [IP: 51.79.159.216 443]