how i can printall elements befor the spicific value and print this value also
Hi Friend,
Try this:
<html> <script> var arr=new Array(); arr[0]=10; arr[1]=20; arr[2]=30; arr[3]=40; arr[4]=50; arr[5]=60; arr[6]=70; arr[7]=80; arr[8]=90; arr[9]=100; var i; var num=window.prompt("Enter array element: "); document.writeln("The value is: "+num+"<br>"); for(i=0;i<arr.length;i++){ if(arr[i]<num){ document.writeln(arr[i]+"<br>"); } } </script> </html>
Thanks