function ran(){
var num =[];
for(var i=0;i<3;i++){
num.push(Math.floor(Math.random() * 100) +1);
}
console.log(num);//已经得到了三个随机整数
var sortnum = num.sort(); //排序,
return {max: sortnum[2], min: sortnum[0], all: sortnum};
}
console.log(ran());
输出结果: max 是最大值; min是最小值; all是三个数字的数组