#FoodForThought
Food for Thought
Following is the code to alert max number in an array. Can you think of a way to get the result without using loops ? Explore it yourself...
var numbers = [4,76,455,56,90,22];
var max = 0;
for(i=0;i<numbers.length;i++){
if(numbers[i]>max){
max = numbers[i];
}
}
alert("Maximum Number : "+max);
Join @javascriptdaily for more updates of Daily JavaScript / JS community news, links and events.
Food for Thought
Following is the code to alert max number in an array. Can you think of a way to get the result without using loops ? Explore it yourself...
var numbers = [4,76,455,56,90,22];
var max = 0;
for(i=0;i<numbers.length;i++){
if(numbers[i]>max){
max = numbers[i];
}
}
alert("Maximum Number : "+max);
Join @javascriptdaily for more updates of Daily JavaScript / JS community news, links and events.