javascript remove negative from number code example
Example 1: convert negative number to positive in javascript
Math.abs("the negative number")
Example 2: javascript remove negative numbers from array
var array = [18, -42, 21, 6, -50];
array = array.filter(function(x) { return x > -1; });
console.log(array); // [18, 21, 6]