I have 2 Arrays:
var ids = new Array(1234,4113,1111,1111,1234,1234);
var datas = new Array(2,4,5,1,2,8);
I want to get total min. & max. values from datas array but it must be filtered, so same id can not be counted.
//example result:
var min = 2 * 4 * 1;
//example result:
var max = 8 * 4 * 2;
Any ideas?
Thanks!
John Resig (of jQuery) has suggested a great set of methods for this ( blog post ):
Array.max = function( array ){
return Math.max.apply( Math, array );
};
Array.min = function( array ){
return Math.min.apply( Math, array );
};
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.