Ad
Code
Diff
  • var getMin = function (list){
      var min = Number.MAX_VALUE;
      list.map((n)=>{if(n > 0 && n < min) min = n;});
      return min == Number.MAX_VALUE ? 0 : min;
    }
    • var getMin = function (list){
    • var min = Number.MAX_VALUE;
    • for (var i = 0; i < list.length; i++) {
    • if (+list[i] <= 0) {
    • continue;
    • }
    • min = Math.min(min, +list[i]);
    • }
    • return min = min === Number.MAX_VALUE ? 0 : min;
    • list.map((n)=>{if(n > 0 && n < min) min = n;});
    • return min == Number.MAX_VALUE ? 0 : min;
    • }