javascript remove negative numbers from array code example
Example: 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]
var array = [18, -42, 21, 6, -50];
array = array.filter(function(x) { return x > -1; });
console.log(array); // [18, 21, 6]