<html>
<head>
<title>Write your title here </title>
<script type="text/javascript" >
var x;
var str=new Array();
str[0]="This";
str[1]=1;
str[2]=true;
str[3]=323.233;
document.write("<b>Using simple for loop</b> <br/>");
for(i=0;i<str.length;i++)
{
document.write(str[i]+"<br/>");
}
document.write("<b>Using for...in or for each loop</b> <br/>");
for(x in str)
{
document.write(str[x]+"<br/>");
}
</script>
</head>
</html>
Output:
Using simple for loop This 1 true 323.233 Using for...in or for each loop This 1 true 323.233If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.