Ad

get smallest positive number form array.
if no positive number in array, return 0.
example:

var list1 = [0, 1, 1, 3];
var list2 = [7, 2, null, 3, 0, 10];
var list2 = [null];
getMin(list1); //should return 1
getMin(list2); //should return 2
getMin(list3); //should return 0
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;
}