javascript --- 数组输出数组中最大值最小值差值

Array.prototype.outputMaxPrice  = function outputMaxPrice (array) {

  const item1 = Math.max.apply( Math, array );

  const item2 = Math.min.apply( Math, array );

  return item1 - item2;
}

const array = new Array;

array.outputMaxPrice ([1, 3, 33, 44])   //  43

原文地址:https://www.cnblogs.com/GongYaLei/p/7758249.html