Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

JavaScript loop Array

var min = arr[0];
var max = arr[0];

for(var i=1; i<arr.length; i++){
	if(arr[i] < min){
		min = arr[i];
}
	if(arr[i] > max){
		max = arr[i];
}


return [min, max];
}
Source by www.hackerhero.com #
 
PREVIOUS NEXT
Tagged: #JavaScript #loop #Array
ADD COMMENT
Topic
Name
8+1 =