How to replace a negative number in an array with the value of 0 in JavaScript e.g.
[1,5,10,-2] will become [1,5,10,0]
I tried
function noNeg(arr) {
let num
return num = arr < 0 ? 0 : arr
}
but it only returns the negative into positive not zero.