Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa JavaScriptQuestions how i can print the elements before a spicific value in array queue?

Have Programming Question? Ask it here!
 
 
 


afnan
how i can print the elements before a spicific value in array queue?
1 Answer(s)      3 years and 8 months ago
Posted in : JavaScript Questions


how i can printall elements befor the spicific value and print this value also


Advertisement
View Answers

January 8, 2011 at 4:05 PM


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



Related Tutorials/Questions & Answers:
Advertisements
 

 

 

DMCA.com