I want a output of [-1,-2,-7,-3] array using javascript i have to find maximum in this
var arr = [-1,-2,-3,-6,-7]; var max = 0; for(var i = 0; i < arr.length; i++) { if(arr[i] < 0 && arr[i] > max) { max = arr[i]; } } console.log(max);
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)